|
CX Framework
Cross-platform C utility framework
|
#include <event.h>
Public Member Functions | |
| atomic (uintptr) ref | |
| Reference count. | |
Data Fields | |
| Event | ev |
| Underlying event. | |
Reference-counted event for shared ownership between threads
A common pattern is an event shared between two threads where one signals the other when something is complete. This makes managing the event's lifetime difficult, as it's not safe for it to live on the stack or for one thread to free it.
SharedEvent provides a reference-counted wrapper that can be safely cleaned up when both threads are done with it using sheventAcquire() and sheventRelease().
Example: