1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef RTC_BASE_EVENT_H_
- #define RTC_BASE_EVENT_H_
- #if defined(WEBRTC_WIN)
- #include <windows.h>
- #elif defined(WEBRTC_POSIX)
- #include <pthread.h>
- #else
- #error "Must define either WEBRTC_WIN or WEBRTC_POSIX."
- #endif
- namespace rtc {
- class Event {
- public:
- static const int kForever = -1;
- Event();
- Event(bool manual_reset, bool initially_signaled);
- Event(const Event&) = delete;
- Event& operator=(const Event&) = delete;
- ~Event();
- void Set();
- void Reset();
-
-
-
-
-
-
-
-
- bool Wait(int give_up_after_ms, int warn_after_ms);
-
- bool Wait(int give_up_after_ms) {
- return Wait(give_up_after_ms,
- give_up_after_ms == kForever ? 3000 : kForever);
- }
- private:
- #if defined(WEBRTC_WIN)
- HANDLE event_handle_;
- #elif defined(WEBRTC_POSIX)
- pthread_mutex_t event_mutex_;
- pthread_cond_t event_cond_;
- const bool is_manual_reset_;
- bool event_status_;
- #endif
- };
- class ScopedAllowBaseSyncPrimitives {
- public:
- ScopedAllowBaseSyncPrimitives() {}
- ~ScopedAllowBaseSyncPrimitives() {}
- };
- class ScopedAllowBaseSyncPrimitivesForTesting {
- public:
- ScopedAllowBaseSyncPrimitivesForTesting() {}
- ~ScopedAllowBaseSyncPrimitivesForTesting() {}
- };
- }
- #endif
|