On 11/02/2008, Damien Gerard <[EMAIL PROTECTED]> wrote: > 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*... > > Is there any TSemaphore class of equivalent ? Or may be an example how > to use Semaphores ? :)
I've wondered the same thing.... In the end I had to write code like the following: Not idea, but it works. We needed to support Linux and Windows only. procedure TtiPool.CreatePoolSemaphore; begin {$IFDEF MSWINDOWS} if FSemaphore <> 0 then CloseHandle(FSemaphore); FSemaphore := CreateSemaphore(nil, FMaxPoolSize, FMaxPoolSize, nil); {$ENDIF MSWINDOWS} {$IFDEF LINUX} sem_destroy(FSemaphore); if sem_init(FSemaphore, 0, FMaxPoolSize) <> 0 then raise Exception.Create('Failed to create the semaphore'); {$ENDIF LINUX} end; Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal