|
Boost Users : |
Subject: Re: [Boost-users] filesystem::path threadsafe ?? (1.48) Options
From: Aris Basic (aris.basic_at_[hidden])
Date: 2011-12-23 10:45:38
Here is the sample code that crashes every time
i compile project as multibyte and not unicode and ahve user wchar_t
as default type
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
int main(void)
{
std::string sPath("c:\\Development");
boost::thread_group tg;
for(int i = 0; i < 10; i++)
{
tg.create_thread([&sPath](){
boost::this_thread::sleep(boost::posix_time::milliseconds(10));
boost::filesystem::path p(sPath);
boost::filesystem::directory_iterator di(p), end;
while(di != end)
std::cout << (*di).path().string() << std::endl;
});
}
tg.join_all();
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net