3 ms·
PulseEvent was identified as harmful more than two decades ago; there is no reason to proliferate it. It only worked meaningfully under cooperative multitasking
by kazinator 10y ago
PulseEvent was identified as harmful more than two decades ago; there is no reason to proliferate it. It only worked meaningfully under cooperative multitasking in 16 bit Windows 3.x. In that OS, one task ran at a time, so it was as if a global mutex were being held at all times.
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.
- ComputerGuru 10y agoI agree with you 100% and then some. Unfortunately (and you can probably see this by going back and looking at the commit history, <3 open source and version control!) you have no idea the number of emails I received about this being an "incomplete solution" and "incompatible with porting existing Win32 code" because of the lack of PulseEvent. 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.