Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2001 06:20:02 -0700 (PDT)
From:      Peter Pentchev <roam@ringlet.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/30781: msgrcv call blocks other pthread's jobs
Message-ID:  <200109241320.f8ODK2B78637@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/30781; it has been noted by GNATS.

From: Peter Pentchev <roam@ringlet.net>
To: "Choi, Dong-won" <dwchoe@naver.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/30781: msgrcv call blocks other pthread's jobs
Date: Mon, 24 Sep 2001 16:14:03 +0300

 On Mon, Sep 24, 2001 at 01:58:54AM -0700, dwchoe@naver.com wrote:
 > 
 > >Number:         30781
 > >Category:       kern
 > >Synopsis:       msgrcv call blocks other pthread's jobs
 > >Originator:     Choi, Dong-won
 > >Release:        FreeBSD 4.2-20010108-STABLE
 > >Organization:
 > Naver.COM
 > >Environment:
 > FreeBSD 4.2-20010108-STABLE #0: Thu Jan 11 09:23:26 KST 2001     /usr/src/sys/compile/MYKERNEL  i386
 > >Description:
 > A program using msgrcv call and pthread do not run as expected.
 > One thread calls msgrcv and wait until some messages are arrived.
 > Other thread does its given jobs.
 > And some other threads can call msgsnd to send messages.
 > All threads need to run concurruntly.
 > It's just ok under Linux or SunOS.
 
 In FreeBSD, all threads live within one process.  This means that if
 one thread should make a blocking system call, the whole process blocks
 until the call returns.  The way around this is to make your system calls
 not block.  For syscalls dealing with file descriptors, the fd's need to
 be set into non-blocking mode.  Other syscalls have their own ways of
 specifying non-blocking operation.
 	
 For msgrcv(3), it is the msgflg parameter - read the msgrcv(3) manual page
 and set the IPC_NOWAIT flag.  Then have your main thread call msgrcv(3)
 in non-blocking mode and if it returns nothing, sleep for a while before
 the next call.
 
 G'luck,
 Peter
 
 -- 
 What would this sentence be like if it weren't self-referential?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109241320.f8ODK2B78637>