forked from neosmart/pevents
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
54 lines (38 loc) · 2.05 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pevents is a C++ library meant to provide an implementation of the WIN32
events for POSIX systems. pevents is built on pthreads and provides
*most* of the functionality of both manual- and auto-reset events on
Windows, including simultaneous waits on multiple events (à la
WaitForMultipleObjects).
pevents is developed and maintained by Mahmoud Al-Qudsi
<[email protected]> of NeoSmart Technologies <http://neosmart.net/>
While POSIX condition variables (pthread_cond_t) and WIN32 events both
provide the essential building blocks of the synchronization primitives
required to write multithreaded code with signaling, the nature of the
differences between the two have lent their way towards creating
different synchronization and multithreaded-programming paradigms.
Developers accustomed to WIN32 events might have a hard time
transitioning to condition variables; pevents aims to ease the
transition for Windows developers looking to write multithreaded code on
*nix by providing a familiar synchronization primitive that will allow
them to duplicate the essential features of WIN32 auto/manual-reset
events.
As mentioned earlier, pevents provides most of the functionality of
WIN32 events. The features not included are named events, security
attributes, and the completely useless PulseEvent.
Usage:
pevents comes with two APIs: one along the lines of WIN32 functions and
the other for those more comfortable with pthread functions. They are
identical underneath the hood.
WIN32-style pevents API:
neosmart_event_t CreateEvent(bool manualReset, bool initialState);
int DestroyEvent(neosmart_event_t event);
int WaitForEvent(neosmart_event_t event, uint64_t milliseconds);
int WaitForMultipleEvents(neosmart_event_t *events, int count,
bool waitAll, uint64_t milliseconds, int &index);
int SetEvent(neosmart_event_t event);
int ResetEvent(neosmart_event_t event);
POSIX-style pevents API:
//TBD
All the code is contained within pevents.cpp and pevents.h. You should
include these two files in your project as needed. All functions are in
the neosmart namespace.