Opened 14 years ago
Closed 14 years ago
#1958 closed Bugs (fixed)
thread_specific_ptr lacks support for NULL cleanup function
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Boost 1.36.0 | Component: | thread |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | cleanup_function tss thread_specific_ptr | Cc: |
Description
Passing a null pointer as the cleanup_function argument to the thread_specific_ptr constructor leads to a null dereference and a program crash.
Use of a null cleanup function is well defined in the pthread API: it means that no cleanup is to be performed. Boost::Thread currently lacks this mode, requiring the programmer to define a specialized empty function any time a thread_specific_ptr is created where no cleanup is desired.
I'm filing this as a bug, since it represents a common practice, well supported and documented in the pthread API, which in boost leads to a program crash.
I'm attaching a patch representing a potential implementation of NULL-cleanup-function support.
patch to apply at ROOT/boost/thread for NULL cleanup_function support