[fpc-pascal] Semaphore

Damien Gerard milipili at shikami.org
Tue Feb 12 14:55:28 CET 2008


Le Feb 12, 2008 à 2:41 PM, Jonas Maebe a écrit :

>
> On 11 Feb 2008, at 10:45, Damien Gerard wrote:
>
>> I think it has been discussed before but I would like to use  
>> Semaphores, to allow multiple reads but 1 write at once (which is  
>> in fact commons operations in a multi-thread program).
>>
>> My program must work under OSX/Nux and Windows.
>> I may have missed something but I can not find something suitable  
>> for me.
>> Under Windows OpenSemaphore, under unixes CurrentTM.Semaphore*...
>
> CurrentTM.Semaphore* should also work under Windows (if it doesn't,  
> please file a bug report). And the way to use those is by calling
>
> {$ifdef unix}
> uses
>  cthreads;
> {$endif}
> var
>  p: pointer;
> begin
>  p:=currenttm.SemaphoreInit;
>  currenttm.semaphorepost(p);
>  currenttm.semaphorewait(p);
>  currenttm.semaphoredestroy(p);
> end.



I though that too but currenttm can not be found under Windows. What  
is the good unit for it ?

--
Damien Gerard
milipili at shikami.org

Le temps n'a pas d'importance. Seul le code est important
    -- (f00ty)







More information about the fpc-pascal mailing list