Bug in boost::thread

If one creates a new boost::thread within DLLMain or a function it invokes, CreateThread (invoked by Boost) creates a new thread but does not start it. Boost's code then waits on the native thread to start before returning from the constructor but because this never occurs it blocks forever. You should either document this limitation (i.e. one may not create a boost::thread within DLLMain or a function invoked by it) or change the implementation to handle this limitation. Thank you, Gili -- http://www.desktopbeautifier.com/

I don't understand. What about the quite explicit message in http://www.boost.org/doc/html/threads/implementation_notes.html#threads.impl ementation_notes.win32 ? /David
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gili Sent: Tuesday, July 12, 2005 11:50 PM To: boost@lists.boost.org Subject: [boost] Bug in boost::thread
If one creates a new boost::thread within DLLMain or a function it invokes, CreateThread (invoked by Boost) creates a new thread but does not start it. Boost's code then waits on the native thread to start before returning from the constructor but because this never occurs it blocks forever.
You should either document this limitation (i.e. one may not create a boost::thread within DLLMain or a function invoked by it) or change the implementation to handle this limitation.
Thank you, Gili -- http://www.desktopbeautifier.com/ _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

David Bergman wrote:
I don't understand. What about the quite explicit message in http://www.boost.org/doc/html/threads/implementation_notes.html#threads.impl ementation_notes.win32 ?
I'm not sure that "Implementation Notes" is a good subject heading for a descriptions of implementation limitations. "Implementation Notes" sounds like it will contain a discussion of how the library interface is implemented, rather than how the library fails to implement the interface. I'd prefer "Limitations of the Current Implementation." Jonathan

On Tue, 12 Jul 2005 23:50:08 -0400, Gili <cowwoc@bbs.darktech.org> wrote:
If one creates a new boost::thread within DLLMain or a function it invokes, CreateThread (invoked by Boost) creates a new thread but does not start it. Boost's code then waits on the native thread to start before returning from the constructor but because this never occurs it blocks forever.
Does boost::thread use CreateThread? Is the author aware of the potential memory leaks that can result from this?
From MSDN:
"A thread that uses functions from the static C run-time libraries should use the _beginthread and _endthread C run-time functions for thread management rather than CreateThread and ExitThread. Failure to do so results in small memory leaks when ExitThread is called. Note that this is not a problem with the C run-time in a DLL." -- Be seeing you.
participants (4)
-
David Bergman
-
Gili
-
Jonathan Turkanis
-
Thore Karlsen