[fpc-pascal] Semaphores removed from the rtl?

Michael Schnell mschnell at lumino.de
Thu Jul 20 10:14:14 CEST 2017


On 19.07.2017 18:58, Karoly Balogh (Charlie/SGR) wrote:
> You are free to implement Semaphore-alike behavior using 
> CriticalSections for example, which are implemented on all platforms 
> which support Threading in the FPC RTL.

CriticalSection is the windows-name for Futex, and in Windows (10) the 
appropriate Library  call in fact is a hight performance user space Mutex.

In other environments TCriticalSection is implemented by a "Mutex" 
system call (supposedly because not all archs / OSes provide "Futex"), 
and seemingly pthreadlib in Linux (AFAIK) is not intended to be used  
for this.

Hence, generally, CriticalSection can only be used to construct 
inter-Thread Semaphores not inter-Process Semaphores.

-Michael



More information about the fpc-pascal mailing list