On Mon, Apr 13, 2009 at 11:49 PM, Seth Grover <sethdgro...@gmail.com> wrote: > Is there not a cross-platform semaphore API in Free Pascal? I planned
About 4 years ago there wasn't, so I had to use IFDEF's in my code. I haven't looked in newer versions of FPC if there is a cross-platform API available. I would be interested in this as well. This is what I had to do... [...snip...] {$IFDEF MSWINDOWS} FSemaphore : THandle; {$ENDIF MSWINDOWS} {$IFDEF LINUX} FSemaphore : TSemaphore; {$ENDIF LINUX} [...snip...] 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