Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #55

Re: mkdir() and thread safety()

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.os.linux.development.apps
Subject Re: mkdir() and thread safety()
Date 2011-03-30 15:44 +0100
Message-ID <878vvw652f.fsf@sapphire.mobileactivedefense.com> (permalink)
References <9d56213c-a054-428e-866c-559da29fbbc3@o21g2000prh.googlegroups.com> <2d58ece6-bb9c-42e0-a990-fc13b92723ec@a21g2000prj.googlegroups.com> <87oc4vtn8o.fsf@sapphire.mobileactivedefense.com> <616f7ca6-9853-4c8d-af92-983ca41365e6@g3g2000prg.googlegroups.com>

Show all headers | View raw


mkaushik <mayank.utexas@gmail.com> writes:
> On Mar 28, 5:59 am, Rainer Weikusat <rweiku...@mssgmbh.com> wrote:
>> David Schwartz <dav...@webmaster.com> writes:
>> > On Mar 25, 5:56 pm, mkaushik <mayank.ute...@gmail.com> wrote:
>> >> I have two threads, each tries to create a directory of the same name
>> >> at the same location using mkdir(). The threads need to be oblivious
>> >> of each others' existence. Do I have to worry about concurrency when I
>> >> use mkdir() to create this directory? Or will mkdir() always return
>> >> success in one thread and EEXIST in the other?

[...]

> Thanks for the answers everyone!

Something which hasn't been mentioned explicitly so far: It is
possible that both calls fail with EEXIST despite one created the
directory: Provided that some kind of network filesystem with a
stateless server is being used (IOW, NFS). It is possible that the
server crashes after it created the directory but before it could send
a reply to the client which requested the action. Once the server is
again available, the retransmitted 'create this directory' requests
from the client should lead to EEXIST.

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Find similar


Thread

Re: mkdir() and thread safety() mkaushik <mayank.utexas@gmail.com> - 2011-03-30 00:37 -0700
  Re: mkdir() and thread safety() Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-03-30 15:44 +0100

csiph-web