From owner-freebsd-current Fri Oct 2 06:44:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA27998 for freebsd-current-outgoing; Fri, 2 Oct 1998 06:44:44 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA27993 for ; Fri, 2 Oct 1998 06:44:42 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id JAA11670; Fri, 2 Oct 1998 09:44:27 -0400 (EDT) Date: Fri, 2 Oct 1998 09:44:27 -0400 (EDT) From: Daniel Eischen Message-Id: <199810021344.JAA11670@pcnet1.pcnet.com> To: freebsd-current@FreeBSD.ORG, rrs@LMI.Net Subject: Re: pthread behavior Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Robert Schulhof wrote: > I am not sure if this is the expected behavior according to the current > IEEE standard, but sleep calls in any thread seem to suspend a process. > Also when a thread waits on a semop it seems to put the whole > process to sleep. Are semaphores thread safe? I've tried compiling > with cc and with egcs 1.1. The weird part is that the program will > occasionally work correctly ( The semop calls, that is. sleep doesn't > work). This program behaves as I expect Solaris 2.5.1. Under FreeBSD > 2.2.7-Stable it freezes my terminal :-) Might be pilot error. semop isn't currently wrapped by the threads library. You should submit a PR so it doesn't get lost. sleep shouldn't put the process to sleep - other threads should continue to run. My tests with sleep don't exhibit this behaviour. > ACE wrappers, which worked before the recent changes to libc_r, now > produces the following in the Semaphore/Threads test: > > Fatal error 'Dead thread has resumed' at line ? in file /usr/src/src/lib/libc_r/ > uthread/uthread_exit.c (errno = ?) > > I get this error about 30% of the time. I'm just learning how to use > ACE wrappers so I shouldn't attempt to figure that one out. This was after > cvsup around 9:30 PM PDT 30 Sep. Is this stable or current (you mention stable above)? > Thanks! I know you're busy so ignore unless this helps with the 3.0 Beta > shakeout. I include the test below. define TEST_SLEEP to test sleep > in a thread. semop isn't threaded, so you can't test sleep because your test program is going to hang the process waiting for a semaphore to be released. Are you sure you need semaphores? Unless you're communicating with another process, you can use mutexes and condition variables to synchronize threads. Dan Eischen eischen@vigrid.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message