|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Auto-reset notification event (condition variable style), optionally named for cross-process use. More...
#include <Utils.h>
Public Member Functions | |
| Event () | |
| Create an anonymous, process-local event. | |
| Event (const char *name) | |
| Create or open a named, cross-process event. | |
| ~Event () | |
| bool | waitNext () |
| Block until the next signal() occurs. | |
| bool | waitNext (uint32 timeout) |
| Wait for a signal with a timeout. | |
| bool | signal () |
| Wake all threads currently waiting on this event. | |
Protected Attributes | |
| char * | name |
| pthread_cond_t * | event |
| pthread_mutex_t * | mutex |
Auto-reset notification event (condition variable style), optionally named for cross-process use.
Unlike a semaphore, signals are not counted: a signal wakes waiters that are currently blocked in waitNext(); there is no memory of past signals.
| cmlabs::utils::Event::Event | ( | ) |
| cmlabs::utils::Event::Event | ( | const char * | name | ) |
Create or open a named, cross-process event.
| name | Global name. |
Definition at line 2114 of file Utils.cpp.
References cmlabs::utils::CreateSharedMemorySegment(), EVENTMEMSIZE, FALSE, cmlabs::utils::SharedEventWord::gen, MAXSHMEMNAMELEN, mutex, name, cmlabs::utils::OpenSharedMemorySegment(), TRUE, cmlabs::utils::SharedEventWord::waiters, and WINSHMEMSPACE.
| cmlabs::utils::Event::~Event | ( | ) |
Definition at line 2141 of file Utils.cpp.
References cmlabs::utils::CloseSharedMemorySegment(), event, EVENTMEMSIZE, mutex, and name.
| bool cmlabs::utils::Event::signal | ( | ) |
Wake all threads currently waiting on this event.
Definition at line 2193 of file Utils.cpp.
References event, cmlabs::utils::EventWordSignal(), mutex, and name.
Referenced by cmlabs::PsySpace::emitSignal(), cmlabs::utils::UnitTest_EventUserDeath(), and cmlabs::utils::UnitTest_SharedNames().
| bool cmlabs::utils::Event::waitNext | ( | ) |
Block until the next signal() occurs.
Definition at line 2165 of file Utils.cpp.
References event, cmlabs::utils::EventWordWait(), mutex, and name.
Referenced by cmlabs::utils::UnitTest_EventUserDeath(), cmlabs::utils::UnitTest_SharedNames(), cmlabs::utils::WaitForNextEvent(), and cmlabs::PsySpace::waitForSignal().
| bool cmlabs::utils::Event::waitNext | ( | uint32 | timeout | ) |
Wait for a signal with a timeout.
| timeout | Max wait in milliseconds. |
Definition at line 2178 of file Utils.cpp.
References cmlabs::utils::CalcTimeout(), event, cmlabs::utils::EventWordWait(), mutex, and name.
|
protected |
Definition at line 586 of file Utils.h.
Referenced by Event(), signal(), waitNext(), waitNext(), and ~Event().
|
protected |
Definition at line 587 of file Utils.h.
Referenced by Event(), Event(), signal(), waitNext(), waitNext(), and ~Event().
|
protected |
Definition at line 582 of file Utils.h.
Referenced by psyclone_client.remote_module.RemoteModule::_control(), psyclone_client.remote_module.RemoteModule::_do_attach(), psyclone_client.remote_module.RemoteModule::_reattach_later(), psyclone_client.remote_module.RemoteModule::_receive(), Event(), Event(), psyclone_client.remote_module.RemoteModule::post(), psyclone_client.remote_module.RemoteModule::post_confirmed(), psyclone_client.remote_module.RemoteModule::query(), psyclone_client.remote_module.RemoteModule::query_catalog(), signal(), psyclone_client.remote_module.Trigger::to_xml(), waitNext(), waitNext(), and ~Event().