no POSIX timers on OSX

- unbreak OSX build

Closes #891
Esse commit está contido em:
Sean Cannella
2013-07-24 18:16:04 -07:00
commit de Sara Golemon
commit d618b30ed7
2 arquivos alterados com 6 adições e 0 exclusões
+4
Ver Arquivo
@@ -124,9 +124,11 @@ void ThreadInfo::onSessionExit() {
}
RequestInjectionData::~RequestInjectionData() {
#ifndef __APPLE__
if (m_hasTimer) {
timer_delete(m_timer_id);
}
#endif
}
void RequestInjectionData::onSessionInit() {
@@ -156,6 +158,7 @@ void RequestInjectionData::setSurprisePage(void* page) {
}
void RequestInjectionData::setTimeout(int seconds) {
#ifndef __APPLE__
m_timeoutSeconds = seconds > 0 ? seconds : 0;
if (!m_hasTimer) {
if (!m_timeoutSeconds) {
@@ -201,6 +204,7 @@ void RequestInjectionData::setTimeout(int seconds) {
} else {
m_timerActive.store(false, std::memory_order_relaxed);
}
#endif
}
void RequestInjectionData::resetTimer(int seconds /* = -1 */) {
+2
Ver Arquivo
@@ -229,7 +229,9 @@ public:
// protect for error conditions
private:
#ifndef __APPLE__
timer_t m_timer_id; // id of our timer
#endif
int m_timeoutSeconds; // how many seconds to timeout
bool m_hasTimer; // Whether we've created our timer yet
std::atomic<bool> m_timerActive;