system("mkdir -p /tmp/20051128") never returns

system("mkdir -p /tmp/20051128") never returns

Post by egokhma » Sun, 27 Nov 2005 09:29:57


Hi,

I inherited from someone a multithreaded application that issues about 20 or
so system() calls. All similar to:

system("mkdir -p /tmp/20051124");
(Please hold your flames over the usage of system() in multi-threaded
application :-) )
after some time of execution it issues the
system("mkdir -p /tmp/20051128")
which never returns. Could someone recommend a possible theory why it could
happen and suggest a strategy of debugging it?

Note, I have absolutely no problems typing "mkdir -p /tmp/20051128" in a
separate shell window and executing it.

HELP!!!!

Thanx,
Ed Gokhman
 
 
 

system("mkdir -p /tmp/20051128") never returns

Post by noi » Mon, 28 Nov 2005 07:38:57

On Fri, 25 Nov 2005 19:29:57 -0500, egokhman wrote this:


Don't know. Is this C/C++, i = system() ? Or Bash try exec() instead?
In either case maybe the command is failing or the return was lost in the
multi-threaded env. Maybe you could move the temp dir allocation to the
start of the application with error messages if the allocation fails.

 
 
 

system("mkdir -p /tmp/20051128") never returns

Post by scot » Fri, 02 Dec 2005 03:24:42

"egokhman" < XXXX@XXXXX.COM > writes:

Don't use system in a multithreaded application and system(3) won't
hang. Internally system(3) is neither thread-safe, nor re-entrant.

scott