Hi,

I am having troubles with porting Semaphores in a project under Linux.
Under Windows everything works fine, but under Linux my app keeps
freezing.

The project is tiOPF v2 (TechInsite Object Persistent Framework).
There is a class called TtiPool, that handles a pool of database
connections.

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:

 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?
* The calls I am using from pthreads are:
 * sem_init() to create a semaphore
 * sem_wait() to lock the semaphore
 * sem_post() to unlock the semaphore
 All the above with a variable of type TSemaphore.


Now, I have to admit, I don't know much about Semaphore's... Anybody
know of some good documentation or tutorial on the net?
Anything obvious I could be doing wrong?

Regards,
 Graeme.

--
There's no place like 127.0.0.1
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to