Boost C++ Libraries: Ticket #12486: system_error_code for thread safe https://svn.boost.org/trac10/ticket/12486 <p> if(!create_directory(root_shared_dir.c_str())){ </p> <blockquote> <p> error_info info(system_error_code()); if(info.get_error_code() != already_exists_error){ </p> <blockquote> <p> throw interprocess_exception(info); </p> </blockquote> <p> } </p> </blockquote> <blockquote> <p> } </p> </blockquote> <p> If the directory exists, get last error is already_exists_error, but in the multi thread environment, last_error will be rewritten by another thread. </p> <p> Whether this can be improved by compiler options? </p> <p> test environment: MAC OS </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12486 Trac 1.4.3 John Maddock Thu, 20 Oct 2016 18:10:03 GMT <link>https://svn.boost.org/trac10/ticket/12486#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12486#comment:1</guid> <description> <p> Please specify which boost library you are using, and assign this ticket to the appropriate component - otherwise nothing will happen here! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 04 Nov 2016 08:21:31 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/12486#comment:2 https://svn.boost.org/trac10/ticket/12486#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket Ion Gaztañaga Fri, 11 Nov 2016 21:19:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12486#comment:3 https://svn.boost.org/trac10/ticket/12486#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> get_last_error is a wrapper for errno in Unix systems. POSIX requires that errno be threadsafe so there is an errno value for each thread using thread specific data, no other thread can overwrite the last error for this thread. </p> Ticket