git: libc - Fix some recursion issues during thread teardown

看板DFBSD_commit作者時間15年前 (2010/10/05 03:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit 6c4de62c59ba95420ee712e340c8dd8d0ab4b1f9 Author: Matthew Dillon <dillon@apollo.backplane.com> Date: Mon Oct 4 11:35:48 2010 -0700 libc - Fix some recursion issues during thread teardown * thread destructors called by sophisticated pthreaded programs such as firefox can wind up allocating/freeing space multiple times AFTER nmalloc's destructor is run. This can leave the mtmagazine in a weird state because it's destructor fails to NULL-out tp->mags[i].loaded and tp->mags[i].prev. * Properly NULL out tp->mags[i].{loaded,prev} in the destructor. * Lockout mtmagazine use while the mtmagazine is being initialized or destroyed. * Permanently lockout mtmagazine use after its destructor has been run. * Instead of trying to initialize the mtmagazine on the first free, which might not occur until the destrutor is run (causing pthreads to complain about destructors being left hanging), have libthread_xu call a new function _nmalloc_thr_init() during thread creation and do all the slab initialization there. Summary of changes: lib/libc/include/libc_private.h | 1 + lib/libc/stdlib/nmalloc.c | 96 ++++++++++++++++++++++++++-------- lib/libthread_xu/thread/thr_create.c | 1 + 3 files changed, 75 insertions(+), 23 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6c4de62c59ba95420ee712e340c8dd8d0ab4b1f9 -- DragonFly BSD source repository
文章代碼(AID): #1CgYHoZi (DFBSD_commit)