Date: Fri, 15 Aug 1997 02:49:15 -0700 (PDT) From: "Andrew N. Edmond" <edmond@shaman.lycaeum.org> To: current@freebsd.org Subject: 3.0: problems with libc_r and native pthreads Message-ID: <Pine.BSF.3.96.970815023942.3581S-100000@necropolis.org>
next in thread | raw e-mail | index | archive | help
I upgraded one of my single processor machines to FreeBSD 3.0 (august 11th
SNAP) to test out the new native pthreads, and have a question to ask (or
perhaps error to report).
I wrote a multithreaded program that's running a thread with listen() and
an accept() in a loop, that when hit reads about 512 bytes of data from
the socket, spawns a new thread and goes back to accept() wait for
another connection.
Now, with mit-pthreads, I can throw a good 500 hits per second into this
mechanism and it runs perfectly without any loss of data. If instead I
use libc_r, I get this error message:
error reading stream message: Resource temporarily unavailable
error reading stream message: Resource temporarily unavailable
error reading stream message: Resource temporarily unavailable
error reading stream message: Resource temporarily unavailable
error reading stream message: Resource temporarily unavailable
This is generated from this code:
listen(socketOpen, QUEUED_CONNECTS);
do {
ptrbuf = buf = (char *) malloc (PACKET_SIZE);
bzero(buf, sizeof(buf));
msgSock = accept(socketOpen, 0, 0);
if (msgSock == -1) perror ("error on accept");
else do {
if ((nread = read(msgSock, ptrbuf, 256)) < 0)
---> perror("error reading stream message");
ptrbuf += nread;
} while (nread != 0);
close(msgSock);
// add to thread pool
tpool_add_work(threadPool, myFunction, (void *)buf);
} while (1);
I assume this is because there are not enough file descriptors available
for some reason in libc_r (but there is in mit-pthreads!). I even set:
#define FD_SETSIZE 8192
In the source of my program before any other includes.
Is this a libc_r error or am I missing something?
Andy
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\-/ :::::::: Andrew N. Edmond - finger for PGP key :::::::::: \-/
/-\ :::::: ............ :::::: /-\
\-/ ::: edmond@lycaeum.org :::::: an1@anon.nymserver.com ::: \-/
/-\ : Director of the Lycaeum :: the Nymserver Administrator : /-\
\-/ ::: www.lycaeum.org :::::: www.nymserver.com ::: \-/
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970815023942.3581S-100000>
