[fpc-devel] Exact details for RTLeventWaitFor and related ?

Sven Barth pascaldragon at googlemail.com
Sat Aug 22 12:50:55 CEST 2020


Am 22.08.2020 um 02:44 schrieb Martin via fpc-devel:
> I am tracing a race condition in lazCollections TLazThreadedQueue
> on win-64
>
> What is supposed to happen in the following case:
>
> 2 or more threads are waiting on the some event
>   RTLeventWaitFor(UniqueEvent)
>
> 1 thread sets it
>   RTLeventSetEvent(UniqueEvent)
>
> I expect that wakes up exactly ONE thread (never mind wich)?
> Or ALL?
>
> If no one resets the event (NO call to RTLeventResetEvent), then that 
> does not change anything? It is still just the one thread that got 
> woken up?

On Windows these are direct calls to the WinAPI functions 
WaitForSingleObject and SetEvent (and the created event is an Auto Reset 
Event), so you should probably take a look at the MSDN documentation for 
them...

Regards,
Sven


More information about the fpc-devel mailing list