General Category > General Discussion about just::thread
Thread Local Storage
Anthony Williams:
--- Quote from: TA on February 03, 2011, 02:53:11 PM ---
--- Quote from: TA on February 03, 2011, 02:36:18 PM ---Maybe. boost::thread_specific_ptr is slightly different again: though each pointer is freed automatically, you have to manually allocate and construct the object for each thread.
--- End quote ---
It is, but at least it allows to have thread local objects and not to worry about freeing it up afterwards, which is simply impossible with __declspec(thread).
As far as I know boost::thread_specific is handled in special way in boost::thread calling procedure, so I can't use boost::thread_specific in std::thread, is it right?
--- End quote ---
You should be able to use boost::thread_specific_ptr alongside std::thread. boost::thread_specific_ptr provides automatic cleanup for non-boost threads for the compilers supported by just::thread. On Windows, you might have to use the DLL version of boost, though, since the static library might clash with the just::thread library for the automatic cleanup hook.
TA:
Thanks.
Navigation
[0] Message Index
[*] Previous page
Go to full version