Just to be clear, I was *not* advocating the use of files as a
semaphore. I'm just saying its one of your alternatives. Sometimes you
just gotta do what you gotta do (for example from a bourne shell
program). Not that I'm trying to get anyone to use this method (I
wouldn't) but unless you're flail
> This is a multi-part message in MIME format.
> --2FC454B1D9AB31B600F414F0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Yes a "semaphore" is very portable (at least within Unix environments).
> You can also use "flock()" on a file. Another trick
> This is a multi-part message in MIME format.
> --425D82A4160873822A800BC6
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Julie wrote:
> > Both of the file-based mechanisms can fail if the two
> > processes are pounding on a non-local filesystem.
Julie wrote:
> Both of the file-based mechanisms can fail if the two
> processes are pounding on a non-local filesystem.
>
> They also tend to be DOG SLOW.
Agreed. The "semaphore" is the way to go.
Of course unless you're trying to synchronize across multiple systems it
wouldn't make sense to
Matt,
From: Matt Fahrner <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 14, 2000 09:10
Subject: Re: synchronization between processes (not threads)
> Yes a "semaphore" is very portable (at least within Unix environments).
> You can also use "
Yes a "semaphore" is very portable (at least within Unix environments).
You can also use "flock()" on a file. Another trick is just to create
and destroy a file as a sort of gate condition.
- Matt
Alan Cox wrote:
>
> > pthread_mutex_, but this is for threads. Do I u
> pthread_mutex_, but this is for threads. Do I use a semaphore? Seems
> like overkill; I just need a binary yes or no lock.
Portably you use a semaphore. If you want to be faster and non portable you
can use shared memory regions and tricks but those may not work on all cpus
--
To unsub
Hello.
I'm new to Linux (mostly a Win32 developer). I am porting some code that
uses the Win32 CreateMutex in order to synchronize access to a file across
several processes. On Win32, a mutex works across processes (not only
threads). I remember a class I took years ago allowed file locking as