Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2001 12:09:20 -0700 (MST)
From:      Nate Williams <nate@yogotech.com>
To:        Allen Landsidel <all@biosys.net>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   RE: Threads vs. blocking sockets
Message-ID:  <15043.34912.938319.558188@nomad.yogotech.com>
In-Reply-To: <4.3.2.7.2.20010329135405.00cab6b8@64.7.7.83>
References:  <F0D64494733BD411BB9A00D0B74A0264021C9C@cpe-24-221-167-196.ca.sprintbbd.net> <4.3.2.7.2.20010329135405.00cab6b8@64.7.7.83>

next in thread | previous in thread | raw e-mail | index | archive | help
> > > 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.

Actually, no.  At least in many threading libraries (including
FreeBSD's), you can't use blocking sockets, because only one thread is
allowed in the kernel.

Therefore, if you call a blocking system call, *ALL* threads block, thus
causing your entire application to 'hang'.




Nate

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




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