Loading ...
Sorry, an error occurred while loading the content.

Re: Lockfiles

Expand Messages
  • clerew5
    ... snip ... Yes, I had not realized that semaphores would work between different processes, but that is clearly the proper way to do it. I see that there are
    Message 1 of 4 , Mar 8, 2012
    • 0 Attachment
      --- In nslu2-linux@yahoogroups.com, David Given <dg@...> wrote:
      >
      > On 02/03/12 22:11, rolandkbs wrote:
      > > Creating a file and checking for its presence is not an atomic operation.
      >
      > Actually...
      >
      > There's a long and honoured art of using the filesystem for locking,
      > using mkdir(2) and rmdir(2), like this:

      snip

      > Of course, named semaphores (see sem_open(3) for details) are better in
      > every possible way, but there are still cases (e.g. mailboxes, or doing
      > things from scripts) where the above approach is suitable.

      Yes, I had not realized that semaphores would work between different processes, but that is clearly the proper way to do it. I see that there are also messages and even shared memory facilities, which might be useful for my problem.
    Your message has been successfully submitted and would be delivered to recipients shortly.