> When I run the Unit Tests and create a single Lock and the Unlock it, > all works fine. If I then iterrate that test by creating 10 locks and > then call unlock 10 times, the Unit Tests freeze on the following line > with the second iteration:
Sounds like some recursion property is not set. > if sem_wait(FSemaphore) <> 0 then > raise EtiOPFInternalException.Create(cErrorTimedOutWaitingForSemaphore); > > * Under Linux, I am using the "pthreads" unit. What is the difference > between the cthreads and pthreads unit? pthreads is a straight header to the platforms POSIX pthreads library. It is as native to the pthreads lib on that platform as possible, so not 100% portable. Cthreads is a bit more complicated; Deep in the RTL/FCL and even the compiler we need threading primitives on *nix, but we don't want to import library pthread always, even if we don't use threading. So we defined a subset of pthreads with uniform typing, and programmed the RTL/FCL against an empty implementation of this interface that is always linked in. Cthreads is the _full_ implementation (that actually pulls in library pthreads) that is a unit on which no other units have any dependancy. By adding it to the project, the threading support is "armed". The Windows platform doesn't need this construct, since linking to the thread functions is not as potentially problematic, so thread support is installed always. So language threading, TCriticalSection and syncobjs are mostly built on top of this interface. Third, there is also the unit IPC, which is more an interface to kernel level IPC. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal