[Lazarus] semaphores

Lukasz Sokol el.es.cr at gmail.com
Tue Feb 14 10:32:21 CET 2012


On 14/02/2012 08:43, Antonio Fortuny wrote:

Hello Antonio,

> Linux ? I'm still looking for a solution equivalent to the Windows
> mutexes. Events seem to be local to a process. Semaphores could be a
> solution but with Lazarus 0.9.31 on an OpenSuse 11.4 64 bit,
> semaphores can only be used unnamed (*sem_init* function is
> available) because function *sem_open* is not defined, only on DARWIN
> OS. The problem with a file is that I don't know how to use it as a
> semaphore with the above constraints. The problem looks like a token
> problem.
> 
> Antonio.
> 

System-wide solutions for Linux is the *Unix-way*, is to create a lock-file;
If you create one on a tmpfs mounted directory, it will all happen in 
memory, hence no hard-drive storage access will happen (unless moved to swap, 
but in your case it won't ever happen) so all you need to do is check for 
lock file existence.
(IMHO)
There is also futex (Fast Userspace muTEX) but I don't know much about that one;
http://en.wikipedia.org/wiki/Futex

HTH.
L.





More information about the Lazarus mailing list