2012-04-02 08:56:30 +02:00
|
|
|
#ifndef THREAD_H
|
|
|
|
#define THREAD_H
|
2012-03-31 09:36:00 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
typedef void (*ThreadProc)(void *);
|
|
|
|
|
2012-04-22 16:45:31 +02:00
|
|
|
/**
|
|
|
|
* Thread
|
|
|
|
*
|
|
|
|
* A wrapper around OS-specific thread functionality.
|
|
|
|
*/
|
2012-04-16 08:36:50 +02:00
|
|
|
class I2_BASE_API Thread
|
2012-03-31 09:36:00 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE m_Thread;
|
|
|
|
#else
|
|
|
|
pthread_t m_Thread;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
public:
|
2012-04-22 16:45:31 +02:00
|
|
|
Thread(ThreadProc callback);
|
2012-04-16 08:36:50 +02:00
|
|
|
~Thread(void);
|
2012-03-31 09:36:00 +02:00
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
void Join(void);
|
2012-03-31 09:36:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* THREAD_H */
|