From owner-freebsd-hackers Fri May 7 13:27: 3 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from luna.lyris.net (unknown [207.90.155.6]) by hub.freebsd.org (Postfix) with ESMTP id 645EA155EE for ; Fri, 7 May 1999 13:26:59 -0700 (PDT) (envelope-from kip@lyris.com) Received: from mail.lyris.com by luna.lyris.net (8.9.1b+Sun/SMI-SVR4) id NAA03474; Fri, 7 May 1999 13:21:27 -0700 (PDT) Received: from (luna.shelby.com [207.90.155.6]) by mail.lyris.com with SMTP (MailShield v1.50); Fri, 07 May 1999 13:26:42 -0700 Date: Fri, 7 May 1999 13:21:27 -0700 (PDT) From: X-Sender: kip@luna To: freebsd-hackers@freebsd.org Subject: pthread_mutex_init requires malloc Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SMTP-HELO: luna X-SMTP-MAIL-FROM: kip@lyris.com X-SMTP-RCPT-TO: freebsd-hackers@freebsd.org X-SMTP-PEER-INFO: luna.shelby.com [207.90.155.6] Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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