|
Boost Users : |
Subject: Re: [Boost-users] Boost thread conflicts with MFC
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-04-09 06:32:58
Igor MI <kostadinovigor_at_[hidden]> writes:
> Is it safe to comment it out? I mean I know I will lose some memory resources
> and thats fine by me, are there any other side effects of commenting this
> hook?
For threads started with boost::thread then there should be no side
effects.
The "leak" affects threads not started with boost::thread, such as the
main thread. Any use of boost::this_thread::get_id() from such a
thread will allocate some memory for the ID, which won't be freed
until app exit. The big issue is with boost::thread_specific_ptr ---
any non-NULL pointers normally have their object destroyed on thread
exit, but this won't happen for non-boost threads if the exit handler
is not called. You can call it manually --- the function to call is
on_thread_exit() from boost/thread/detail/tss_hooks.hpp
Anthony
-- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK
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