by kazinator · 10y ago · 0 comments
PulseEvent resembles a condition variable broadcast which atomically gives up the global mutex and wakes up some waiting threads. Under cooperative tasking, if you change some shared variables and then PulseEvent, it is not possible for some thread to see the old values of those variables, and yet miss the wakeup, because no other thread is running. When the implicit global mutex is gone (preemption, SMP), the function loses its reliable meaning.
PulseEvent should not have been used in 32-bit Windows 95 application coding (preemptively multi-tasked) and thereafter. We're nearing the 21 year anniversary of Windows 95; kids that were born when Win95 came out are starting to pop out universities with CS degrees.
From the README:
-DPULSE: Enables the PulseEvent function. PulseEvent() on Windows is
fundamentally broken and should not be relied upon — it will almost
never do what you think you're doing when you call it. pevents includes
this function only to make porting existing (flawed) code from WIN32 to
*nix platforms easier, and this function is not compiled into pevents by
default.