[Lazarus] semaphores

Antonio Fortuny a.fortuny at sitasoftware.lu
Tue Feb 14 10:48:54 CET 2012



Le 14/02/2012 10:32, Lukasz Sokol a écrit :
> 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;
Got it.
> If you create one on a tmpfs mounted directory,
What do you call a "tmpfs mounted directory" ? I'm only a pascal 
programmer not a system guy
> 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.
Does it mean that every process will have to create the file ? An 
open-close sequence checking the IOResult would be enough ?
> (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.
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120214/85dc3403/attachment-0003.html>


More information about the Lazarus mailing list