close Warning: Can't use blame annotator:
No changeset 1891 in the repository

source: trash/InterruptableSleeper.h@ 5626

Last change on this file since 5626 was 5626, checked in by Christoph Mayer, 15 years ago

logging force nicht unter maemo

File size: 921 bytes
RevLine 
1#ifndef __INTERRUPTABLE_SLEEPER_H
2#define __INTERRUPTABLE_SLEEPER_H
3
4#include <boost/thread/mutex.hpp>
5#include <cassert>
6#include <iostream>
7
8using std::cout;
9
10#ifdef WIN32
11#define WIN32_LEAN_AND_MEAN
12#include <windows.h>
13#else
14#include <pthread.h>
15#include <time.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <sys/types.h>
19#include <sys/timeb.h>
20#include <unistd.h>
21#include <errno.h>
22#endif
23
24namespace spovnet {
25namespace common {
26
27class InterruptableSleeper {
28public:
29 InterruptableSleeper();
30 ~InterruptableSleeper();
31
32 void sleep(unsigned long millis);
33 void interrupt();
34
35private:
36
37#ifdef WIN32
38 HANDLE m_handle;
39#else
40 typedef struct _MUTEX_COND {
41 pthread_cond_t cond;
42 pthread_mutex_t mutex;
43 } MUTEX_COND, *PMUTEX_COND;
44
45 PMUTEX_COND m_handle;
46#endif
47
48 boost::mutex m_mutex;
49};
50
51}
52} // namespace spovnet, common
53
54#endif // __INTERRUPTABLE_SLEEPER_H
Note: See TracBrowser for help on using the repository browser.