X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2FXMLNode.cxx;h=e44a60a32ce3009b89de56e33bf95f1d2f2a0c33;hb=ffe2d7da964403fe2edd542d509a31e65b82e7b5;hp=e2563387569b712c79b3b7289b52674c9d65bc48;hpb=c0fcc541861db7c8009c9e4f0b73cfff568c5934;p=modules%2Fyacs.git diff --git a/src/runtime/XMLNode.cxx b/src/runtime/XMLNode.cxx index e25633875..e44a60a32 100644 --- a/src/runtime/XMLNode.cxx +++ b/src/runtime/XMLNode.cxx @@ -21,6 +21,7 @@ #include "XMLPorts.hxx" #include "Mutex.hxx" #include "TypeCode.hxx" +#include "AutoLocker.hxx" #include #include @@ -91,21 +92,22 @@ void XmlNode::execute() DEBTRACE("execute"); char dir[]="yacsXXXXXX"; // add a lock around mkdtemp (seems not thread safe) - MUTEX.lock(); + { + YACS::BASES::AutoLocker alck(&MUTEX); #ifdef WIN32 - char mdir [512+1]; - GetTempPath(MAX_PATH+1, mdir); - CreateDirectory(mdir, NULL); + char mdir [512+1]; + GetTempPath(MAX_PATH+1, mdir); + CreateDirectory(mdir, NULL); #else - char* mdir=mkdtemp(dir); + char* mdir=mkdtemp(dir); #endif - MUTEX.unlock(); - if(mdir==NULL) - { - perror("mkdtemp failed"); - std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl; - throw Exception("Execution problem in mkdtemp"); - } + if(mdir==NULL) + { + perror("mkdtemp failed"); + std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl; + throw Exception("Execution problem in mkdtemp"); + } + } std::string sdir(dir); std::string input=sdir+"/input"; std::ofstream f(input.c_str());