pthread_exit() and stack unwinding, do you need it ?

David Xu davidxu at freebsd.org
Mon Feb 2 22:43:36 PST 2009


Hi,

This patch had been done in free time when I found nothing to do,
it is used for unwinding stack before thread really exits.

patch:
http://people.freebsd.org/~davidxu/patch/unwind.patch
test cases:
http://people.freebsd.org/~davidxu/patch/unwind_test.tgz

The feature implemented here is that C++ and other languages need
to destruct on-stack objects, the current pthread_exit() does not know
the knowledge and when thread exits, they may cause resource leaks not 
freed by their objects.
This patch has not been tested for enough long time, I am also not a
such binary-level expert, I will be glad to see experts come in and
continue the work, as other OSes have already implemented this
feature. However, I see this as an enhanced feature, and it is not a
must-have feature. It is left to people to determine whether we need
it or not.

Regards,
David Xu



More information about the freebsd-threads mailing list