Le 05/12/12 16:25, Andrew Harvey a écrit :
On 27 November 2012 18:55, Vicente J. Botet Escriba
mailto:vicente.botet@wanadoo.fr> wrote: Le 27/11/12 00:46, Andrew Harvey a écrit : You could always add a function that retrieves it. I don't master this part of Boost.Thread enough to tell you if this could be enough.
Hi,
In the end I didn't really want to maintain my own Boost fork, so I came up with another solution.
The fundamental problem was that the host application, which I have no control over, was unloading my plug-in before the thread had a chance to call the pthread TSS destructor. When the thread did end, a jump to invalid memory would result.
My workaround is to ensure that the plug-in's code is never actually deallocated. I do this by finding the path of the dynamic library and re-loading it myself. Since the library is already in memory, all this does is increment its reference count by one. When the host application later unloads the plug-in, the reference count is decremented but remains non-zero.
Admittedly, it's a hack and platform-specific, but for my specific needs it works. This may be one option for people who run into similar problems.
Glad to see that you have found a workaround as at present I don't have a fix. Best, Vicente