Date: Sat, 2 Feb 2002 07:20:04 -0800 (PST) From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: i386/34536: accept() blocks other threads Message-ID: <200202021520.g12FK3n73297@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/34536; it has been noted by GNATS. From: Peter Pentchev <roam@ringlet.net> To: Yixin <yxpan@yahoo.com> Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: i386/34536: accept() blocks other threads Date: Sat, 2 Feb 2002 17:09:39 +0200 On Fri, Feb 01, 2002 at 11:14:19AM -0800, Yixin wrote: > > >Number: 34536 > >Category: i386 > >Synopsis: accept() blocks other threads > >Description: > I created a simple program: main thread listens to a port, and child > threads serve the requests. If main thread uses accept() to wait for > request, the new thread can not get scheduled. But if main thread uses > select() to wait for request, it works fine. I do not really think this should be considered a problem - accept(2) is a blocking call by default, its manual page does not anywhere document that it has special handling for the threads case. Since currently FreeBSD executes all threads in the context of a single process, a blocking syscall from one thread would certainly block all the others. You can either wait for the new threads and KSE implementation in FreeBSD 5.0, or work around this by using non-blocking sockets and select()'ing on them, as I can see you already do. Another possibility would be to install the linuxthreads port, which simulates the Linux way of handling threads as separate processes. However, I personally would recommend using a non-blocking socket and select() on it. G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org This sentence was in the past tense. 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?200202021520.g12FK3n73297>