This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Semaphores in libc
On Thu, Dec 31, 2009 at 01:14:42PM +0000, Paulo J. Matos wrote:
> fl.l_len = 0;
I'm not really that familiar with file region blocks, but I'd expect
this to be a problem - try non-zero len; but if you end up doing this,
I think semaphores are more elegant. flock() locks (albeit less portable)
might be a better fit.
Ultimately, the best practice is to lock directly the resource you need
exclusive access to - what are you doing in the critical section?
--
Petr "Pasky" Baudis
A lot of people have my books on their bookshelves.
That's the problem, they need to read them. -- Don Knuth