Boost C++ Libraries: Ticket #3531: initial_path is not thread-safe https://svn.boost.org/trac10/ticket/3531 <p> The initial_path template function uses function-local static variable and thus is not thread-safe. </p> <p> The documentation states the recommendadion to call initial_path from the beginning of the main function. However, following it is not sufficient because: </p> <ol><li>If the application consists of several modules (dll or so), on many architectures each module will contain its own copy of the static variable defined in initial_path. Each copy will be initialized as needed, when initial_path is called from within the corresponding module. </li></ol><ol start="2"><li>The threads may already be running when initial_path is called. This may be true regardless of whether initial_path is called from main or some another place in a dll. </li></ol><p> What makes the problem worse is that there are two such functions, actually: initial_path&lt; path &gt;() and initial_path&lt; wpath &gt;(). Each of them will have the described problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3531 Trac 1.4.3 Andrey Semashev Mon, 19 Oct 2009 09:14:39 GMT <link>https://svn.boost.org/trac10/ticket/3531#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3531#comment:1</guid> <description> <p> The suggested solution would be to create a single global variable in the Boost.Filesystem dll, and initialize it of the application startup. On platforms that do not syncronize threads during dll loading (are there any?) one could use call_once from Boost.Thread and initialize it similarly (on the application startup). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Thu, 01 Jul 2010 18:57:30 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3531#comment:2 https://svn.boost.org/trac10/ticket/3531#comment:2 <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">fixed</span> </li> </ul> <p> initial_path() has been deprecated in version 3. </p> <p> --Beman </p> Ticket Andrey Semashev Thu, 01 Jul 2010 22:45:47 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/3531#comment:3 https://svn.boost.org/trac10/ticket/3531#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <ol><li>In v.3 the function "complete" uses detail::initial_path which is still not thread-safe. </li><li>I don't see the reason for removal of this function. </li></ol> Ticket raad@… Mon, 27 Jun 2016 13:36:20 GMT cc set https://svn.boost.org/trac10/ticket/3531#comment:4 https://svn.boost.org/trac10/ticket/3531#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">raad@…</span> added </li> </ul> Ticket