Re: [fpc-pascal] Re: Semaphore problems

2006-07-24 Thread Graeme Geldenhuys
Looking at unit syncobjs might save you some ifdefs and trouble. Thanks for the tip. I always get hassled about keeping the IFDEF's as little as possible. I will go browse the SyncObjs unit now. Regards, Graeme. -- There's no place like 127.0.0.1 ___

Re: [fpc-pascal] Re: Semaphore problems

2006-07-24 Thread Graeme Geldenhuys
Hi Vinzent, You got me one the right track, I think... :-) I thought the counter in Semaphores get incremented, but as you stated (and reading some Man Pages), they get decremented. I then change my code from: > if sem_init(FSemaphore, 0, 1) <> 0 then > raise Exception.Create('Failed to

Re: [fpc-pascal] Re: Semaphore problems

2006-07-24 Thread Vinzent Hoefler
On Monday 24 July 2006 10:21, Graeme Geldenhuys wrote: > procedure TtiPool.CreatePoolSemaphore; > begin > {$IFDEF MSWINDOWS} > if FSemaphore <> 0 then > CloseHandle( FSemaphore ) ; > FSemaphore := CreateSemaphore( nil, FiMaxPoolSize, FiMaxPoolSize, > nil ); {$ENDIF MSWINDOWS} > {$IFDEF

Re: [fpc-pascal] Re: Semaphore problems

2006-07-24 Thread Marco van de Voort
> Looking at my code, I might have initialized my semaphore incorrectly. > > The Windows portion works, and I tried to port it to Linux as follows... > > procedure TtiPool.CreatePoolSemaphore; > begin > {$IFDEF MSWINDOWS} > if FSemaphore <> 0 then > CloseHandle( FSemaphore ) ; > FSemaph

[fpc-pascal] Re: Semaphore problems

2006-07-24 Thread Graeme Geldenhuys
Looking at my code, I might have initialized my semaphore incorrectly. The Windows portion works, and I tried to port it to Linux as follows... procedure TtiPool.CreatePoolSemaphore; begin {$IFDEF MSWINDOWS} if FSemaphore <> 0 then CloseHandle( FSemaphore ) ; FSemaphore := CreateSemaphore(