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 Mon, Jan 04, 2010 at 11:57:35AM -0600, Mark Brown wrote:
> All-
> 
> > Petr Baudis <pasky@suse.cz>
> 
> > mkdir() should be atomic, so each process will always pick a different
> > name.
> 
> 
> POSIX does not guarantee an atomic mkdir(). Section 2.9.7 of the System 
> Interfaces volume of 1003.1-2008 will give you the list of 
> "guaranteed-atomic" interfaces.

Yes, as I said, it isn't described as atomic, which I found curious.

A possible workaround might be to change the loop to pseudo-do

	mkdir(...) && open(..."/.used", O_CREAT|O_EXCL)

				Petr "Pasky" Baudis


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