[fpc-pascal] Counting semaphore for free pascal
Serguei TARASSOV
serge at arbinada.com
Wed Jul 29 12:35:41 CEST 2015
Hello,
On 29/07/2015 12:00, fpc-pascal-request at lists.freepascal.org wrote:
> A counting, or general, semaphore limits simultaneous access to a
> resource according to the number of permits you specify. On the other
> hand, a binary semaphore like a critical section limits the access to
> "one at a time".
Seems, you confuse a little semaphores and critical sections.
In general, semaphores are inter-process but critical sections are not.
I mean that semaphores allow synchronize processes whereas critical
sections are designed to synchronize the threads within the same process.
Some frameworks (i.e. .NET) provide classes like "threading semaphore"
but it is very particular case.
It is possible to use real semaphores to synchronize the threads too
(with some overhead).
Regards,
Serguei
More information about the fpc-pascal
mailing list