From owner-freebsd-questions Wed Sep 12 18:28:41 2001 Delivered-To: freebsd-questions@freebsd.org Received: from midten.fast.no (midten.fast.no [213.188.8.11]) by hub.freebsd.org (Postfix) with ESMTP id A388C37B405 for ; Wed, 12 Sep 2001 18:28:36 -0700 (PDT) Received: from fast.no (IDENT:tegge@midten.fast.no [213.188.8.11]) by midten.fast.no (8.9.3/8.9.3) with ESMTP id DAA16137; Thu, 13 Sep 2001 03:28:27 +0200 (CEST) Message-Id: <200109130128.DAA16137@midten.fast.no> To: jkf@research.bell-labs.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Linux threads loses signal From: Tor.Egge@fast.no In-Reply-To: Your message of "Wed, 12 Sep 2001 16:43:52 -0400 (EDT)" References: <200109122043.QAA23910@zydeco.research.bell-labs.com> X-Mailer: Mew version 1.70 on Emacs 19.34.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Thu_Sep_13_03:25:13_2001)--" Content-Transfer-Encoding: 7bit Date: Thu, 13 Sep 2001 03:28:27 +0200 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----Next_Part(Thu_Sep_13_03:25:13_2001)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit > We have an application using the linuxthreads package, version 2.1.3_2, > installed on FreeBSD 4.3. The application occassionally gets blocked > waiting in pthread_cond_timedwait_relative_old(), at least from the > stack trace. There are many threads, 13, in the application each calling > pthread_cond_timedwait. We have been unable to recreate the problem > in a smaller program, since we don't understand what is happening in > the linuxthreads library with cond_timedwait. The thread is probably restarted before it reduces the resume count in __pthread_timedsuspend_old(), thus no signal is sent by __pthread_restart_old(). > Does any one have ideas on what the problem might be and/or a fix? Try the enclosed patch. It causes __pthread_timedsuspend_old() to assume that a restart signal has already been delivered if the resume count wasn't atomically reduced from 0 to -1 in the first if statement. - Tor Egge ----Next_Part(Thu_Sep_13_03:25:13_2001)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: "files/patch-ab" --- pthread.c.OLD Wed Sep 12 23:28:16 2001 +++ pthread.c Thu Sep 13 00:12:15 2001 @@ -947,7 +947,7 @@ __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) { sigset_t unblock, initial_mask; - int was_signalled = 0; + int was_signalled = 1; sigjmp_buf jmpbuf; if (atomic_decrement(&self->p_resume_count) == 0) { ----Next_Part(Thu_Sep_13_03:25:13_2001)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message