This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: pthread_mutex_destroy returns EBUSY, but the mutex isn't locked
- From: "Adrian Ludwin" <adrian dot ludwin at gmail dot com>
- To: "Carlos O'Donell" <carlos at systemhalted dot org>
- Cc: libc-help at sourceware dot org
- Date: Wed, 4 Jun 2008 10:15:46 -0400
- Subject: Re: pthread_mutex_destroy returns EBUSY, but the mutex isn't locked
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=PDtfNZx5GKVC/ahVwh3JzTxs7W0IqOxSoVA9NuVZYiU=; b=SH36l8SvnRsrpEBgPbxyR1/kKnZNeqyiU4kTxYYIjCTbr1vlfE2fLI2QxNA5n53go5 10ey2dyqyJ9IctIGx+H23ewj9baALf029IjUipueH/Cr74WCK1TsR0+Kq9DSEGsECU0u 0im+OpLxfYvB7bG0tJE1Ri6M20ucxeFxxndQU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=v8N3lkcIoqV8XaoxvuO6UPiycwapQKWiIi0Fe0uhUqcykeGotpUidZdeGkOP5PPXLp Hh/P+wUxpOBzkXuPKSTwZuu0iXSje4qS3oMzbibVI5T1hIMSOhXNmyynJSWfEKsNAfve 2DdN5sXxr8IIll8CcykL7fxdBr+pDX9D+JlhI=
- References: <58fe92790806040548r10e09333x971047764992ca4e@mail.gmail.com> <119aab440806040711v7162178ex6c10204a4573b547@mail.gmail.com>
- Reply-to: adrian dot ludwin at gmail dot com
Hi Carlos,
Thanks, but that seems unlikely for a reason I forgot to mention: all
threads except the main thread have been successfully joined *before*
I attempt to destroy any of the mutexes. In addition, I never create
more than three additional threads for this algorithm (I'm running on
a quad-core machine and the main thread remains active) and I'm
occasionally seeing nusers go as high as 10.
Thanks,
Adrian
On Wed, Jun 4, 2008 at 10:11 AM, Carlos O'Donell
<carlos@systemhalted.org> wrote:
> On Wed, Jun 4, 2008 at 8:48 AM, Adrian Ludwin <adrian.ludwin@gmail.com> wrote:
>> Mutex 0x920df0: lock=0, count=0, owner=0, nusers=2, kind=2
>
> The mutex is unlocked, there are 2 waiters on the futex, but they
> haven't had time to be woken yet, therefore you can't destroy the
> mutex, and calls to pthread_mutex_destroy() return EBUSY.
>
> You shouldn't ignore the error. You should wait a while and try
> destroying it again.
>
> Cheers,
> Carlos.
>