Date: Fri, 7 May 1999 13:21:27 -0700 (PDT) From: <kip@lyris.com> To: freebsd-hackers@freebsd.org Subject: pthread_mutex_init requires malloc Message-ID: <Pine.SOL.4.05.9905071313100.3464-100000@luna>
next in thread | raw e-mail | index | archive | help
I am trying to get a debug replacement for malloc to run on FreeBSD. One problem that I am running across that I have not run across on other platforms is that pthread_mutex_init requires malloc but of course malloc in order to be thread-safe needs a mutex around the pool of memory that it is using. So I get problems like the following: #0 0x283cbc54 in _exit () #1 0x283f623e in exit () #2 0x283c9f96 in _thread_kern_sched () #3 0x283c9feb in _thread_kern_sched_state () #4 0x283dab1b in nanosleep () #5 0x283da84f in sleep () #6 0x82c77ac in MemInitDefaultPool () at defpool.c:28 #7 0x82baaea in malloc (size=436) at shmalloc.c:83 #8 0x283caf50 in _thread_init () #9 0x283f6329 in _thread_init_invoker::_thread_init_invoker () #10 0x283f6350 in global constructors keyed to _thread_init_invoker::_thread_init_invoker () #11 0x28397ec0 in _init () #12 0x283953b9 in _init () #13 0x8002390 in _rtld_error () #14 0x800226a in _rtld () It appears that my malloc is being called before all the thread initialization routines have been run. Any assistance/advice would be much appreciated. -Kip To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.05.9905071313100.3464-100000>