Opened 14 years ago

Closed 14 years ago

#1958 closed Bugs (fixed)

thread_specific_ptr lacks support for NULL cleanup function

Reported by: Bryan Green <bryan.d.green@…> 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.

Attachments (1)

tss_cleanup.patch (1.3 KB ) - added by Bryan Green <bryan.d.green@…> 14 years ago.
patch to apply at ROOT/boost/thread for NULL cleanup_function support

Download all attachments as: .zip

Change History (2)

by Bryan Green <bryan.d.green@…>, 14 years ago

Attachment: tss_cleanup.patch added

patch to apply at ROOT/boost/thread for NULL cleanup_function support

comment:1 by Anthony Williams, 14 years ago

Resolution: fixed
Status: newclosed

Fixed on trunk

Note: See TracTickets for help on using tickets.