From owner-freebsd-stable Thu Mar 29 10:59:22 2001 Delivered-To: freebsd-stable@freebsd.org Received: from ns1.venon.com (ns1.venon.com [64.7.7.83]) by hub.freebsd.org (Postfix) with ESMTP id BC6B737B71A for ; Thu, 29 Mar 2001 10:59:14 -0800 (PST) (envelope-from all@biosys.net) Received: from megalomaniac.biosys.net (megalomaniac.venon.com [64.7.7.82]) by ns1.venon.com (Postfix) with ESMTP id 8C764D1487 for ; Thu, 29 Mar 2001 13:57:35 -0500 (EST) Message-Id: <4.3.2.7.2.20010329135405.00cab6b8@64.7.7.83> X-Sender: (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Thu, 29 Mar 2001 13:59:43 -0500 To: freebsd-stable@freebsd.org From: Allen Landsidel Subject: RE: Threads vs. blocking sockets In-Reply-To: <15043.33567.94042.80830@nomad.yogotech.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 11:46 3/29/2001 -0700, Nate Williams wrote: > > In my experience (on 4 or 5 Unix variants), with a blocking socket either > > everything is sent or an error (or EOF on recv*) is returned. In fact > > FreeBSD also does this, unless you link with libc_r instead of libc. > >Right, but in threaded systems, there are no 'blocking' sockets. You >have to think differently when doing threaded applications. That is really backwards thinking. One of the benefits of threading is that you can use blocking sockets inside each thread and you get the best of both worlds. 1. Your entire application will not block waiting for data to go in/out. 2. Your code for reading can be much simpler when reading a known/required number of bytes from the socket. The bottom line is you can use blocking sockets in a threaded environment, and is probably the only environment where you should. -------signature file------- PGP Key Fingerprint: 446B 7718 B219 9F1E 43DD 8E4A 6BE9 D739 CCC5 7FD7 "I don't think [Linux] will be very successful in the long run." "My experience and some of my friends' experience is that Linux is quite unreliable. Microsoft is really unreliable but Linux is worse." -Ken Thompson, Interview May 1999. http://www.freebsd.org FreeBSD - The Power to Serve http://www.rfnj.org Radio Free New Jersey - 445 streams - 40kbps @ 22khz Stereo http://namespace.org -- http://name.space Resist the ICANN! Support name.space! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message