From owner-freebsd-questions Mon Sep 24 5:13:45 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtpout.mac.com (smtpout.mac.com [204.179.120.88]) by hub.freebsd.org (Postfix) with ESMTP id 63B8837B40C for ; Mon, 24 Sep 2001 05:13:38 -0700 (PDT) Received: by smtpout.mac.com; Mon, 24 Sep 2001 05:11:16 -0700 (PDT) Message-Id: <200109241211.FAA17075@smtpout.mac.com> Received: from asmtp02.mac.com ([10.13.10.66]) by smtp-relay02.mac.com (Netscape Messaging Server 4.15 relay02 Jun 21 2001 23:53:48) with ESMTP id GK61US00.1P7 for ; Mon, 24 Sep 2001 05:11:16 -0700 Received: from localhost ([66.156.166.155]) by asmtp02.mac.com (Netscape Messaging Server 4.15 asmtp02 Jun 21 2001 23:53:48) with ESMTP id GK61UR00.6NI for ; Mon, 24 Sep 2001 05:11:15 -0700 Date: Mon, 24 Sep 2001 07:11:10 -0500 Content-Type: multipart/alternative; boundary=Apple-Mail-468036799-1 X-Mailer: Apple Mail (2.388) From: David Leimbach To: freebsd-questions@FreeBSD.ORG Mime-Version: 1.0 (Apple Message framework v388) In-Reply-To: <200109240233.f8O2XV003913@home.com> Subject: Re: pthread_cond_signal question 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 --Apple-Mail-468036799-1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; format=flowed; charset=us-ascii On Sunday, September 23, 2001, at 09:33 PM, mcbrune wrote: > Yes, I believe you are correct. The call to pthread_cond_signal will > not unblock > a thread that is not waiting, and it does not pend the signal either. > Correct... if nothing is waiting on the signal before the signal is issued, that signal is completely discarded. That means this is NOT a FreeBSD limitation. Its just adhering to the POSIX standard. Try a semaphore instead perhaps. sem_wait, sem_post, sem_init man pages should have more info. > > Corey > > >> Hello All, >> I hope that you can help me decifer the pthread and >> pthread_cond_signal man pages. >> >> >> -The pthread man page for pthread_cond_signal says: >> int pthread_cond_signal(pthread_cond_t *cond) >> Unblock at least one of the threads blocked on the >> specified condition variable. >> >> -And the pthread_cond_signal man page says: >> DESCRIPTION >> The pthread_cond_signal() function unblocks one thread waiting >> for the condition variable cond. >> >> >> All is fine if there is at least on thread waiting on the >> condition variable. However, if there are no threads waiting, then >> the call does not unblock a thread -- this is the behavior that I want >> but it differs from the man page. Can I rely on this behavior or am I >> missing something subtle? >> >> Thanks, >> --Mat >> >> To Unsubscribe: send mail to majordomo@FreeBSD.org >> with "unsubscribe freebsd-questions" in the body of the message >> > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message --Apple-Mail-468036799-1 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=us-ascii On Sunday, September 23, 2001, at 09:33 PM, mcbrune wrote: Yes, I believe you are correct. The call to pthread_cond_signal will not unblock a thread that is not waiting, and it does not pend the signal either. Correct... if nothing is waiting on the signal before the signal is issued, that signal is completely discarded. That means this is NOT a FreeBSD limitation. Its just adhering to the POSIX standard. Try a semaphore instead perhaps. sem_wait, sem_post, sem_init man pages should have more info. 0000,0000,DEB7 Corey Hello All, I hope that you can help me decifer the pthread and pthread_cond_signal man pages. -The pthread man page for pthread_cond_signal says: int pthread_cond_signal(pthread_cond_t *cond) Unblock at least one of the threads blocked on the specified condition variable. -And the pthread_cond_signal man page says: DESCRIPTION The pthread_cond_signal() function unblocks one thread waiting for the condition variable cond. All is fine if there is at least on thread waiting on the condition variable. However, if there are no threads waiting, then the call does not unblock a thread -- this is the behavior that I want but it differs from the man page. Can I rely on this behavior or am I missing something subtle? Thanks, --Mat To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message --Apple-Mail-468036799-1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message