[fpc-pascal] Semaphore

Damien Gerard milipili at shikami.org
Tue Feb 12 15:43:42 CET 2008


Le Feb 12, 2008 à 3:08 PM, Jonas Maebe a écrit :

>
> On 12 Feb 2008, at 14:55, Damien Gerard wrote:
>
>> I though that too but currenttm can not be found under Windows.  
>> What is the good unit for it ?
>
> Indeed, you shouldn't use currenttm. Use this routine instead (from  
> the system unit, the result indicates success or failure):
>
> Function GetThreadManager(Var TM : TThreadManager) : Boolean;



Ok thanks ! I ve got all I need to use Semaphore, except one thing :  
How I set the limit ?
I mean I want to restrict to 4 concurrent accesses to a shared  
ressource.

With pthread I have
int sem_init(sem_t *sem, int pshared, unsigned int value);

but here we have only
TSempahoreInitHandler     = function: Pointer;

Sorry I have for sure missed something :)




--
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