| 56 | } |
| 57 | |
| 58 | bool OSXEventQueueBuffer::addEvent(uint32_t dataID) |
| 59 | { |
| 60 | // Use GCD to dispatch event addition on the main queue |
| 61 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 62 | std::scoped_lock lock{this->m_mutex}; |
| 63 | LOG_DEBUG2("adding user event with dataID: %u", dataID); |
| 64 | this->m_dataQueue.push(dataID); |
| 65 | this->m_cond.notify_one(); |
| 66 | LOG_DEBUG2("user event added to queue, dataID=%u", dataID); |
| 67 | }); |
| 68 | |
| 69 | // Always return true since dispatch_async does not fail under normal conditions |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | bool OSXEventQueueBuffer::isEmpty() const |
| 74 | { |