This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]