I've a C++ application which loads a DLL and passes a callback. The DLL creates its own thread, does some tasks and passes a pointer to boost::barrier object to the main application through the callback. But when I call wait()
on the barrier object, I get an exception "Microsoft C++ exception: boost::exception_detail::clone_impl boost::exception_detail::error_info_injector boost::thread_resource_error> >
.
The same code works fine on OS X. The problem is only on Windows. So I'm guessing there's some Windows specific limitation which I don't know. Google suggested that I may be hitting the limit on the max threads allowed, but my app is not creating more than 20 threads. So I don't think that's the case.
Here are the functions:
From the DLL: s_funPtr(command,s_bar);
s_bar is a static pointer.
In the main app
PortCallback(CString command, boost::barrier* bar)
{
bar->wait(); //Throws an exception
}
Can you see anything wrong with it?