int Window::listen_event(int event_mask, grEvent* grevent) { acquire_sem(_locker); _event_queue.Lock(); BMessage* m = _event_queue.NextMessage(); if (!_event_queue.IsEmpty()) release_sem(_locker); _event_queue.Unlock(); grevent->type = gr_key_down; grevent->key = (grKey)m->what; delete m; return 0; }
status_t WPASupplicantApp::_EnqueueAndNotify(BMessage *message) { if (!fEventQueue.Lock()) return B_ERROR; fEventQueue.AddMessage(message); fEventQueue.Unlock(); return _NotifyEventLoop(); }