[fpc-pascal] Counting semaphore for free pascal
pascaldragon at googlemail.com
Wed Jul 29 15:16:13 CEST 2015
Am 29.07.2015 12:36 schrieb "Serguei TARASSOV" <serge at arbinada.com>:
> 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).
Semaphores don't necessarily need to be cross process.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal