From owner-freebsd-current Fri Aug 15 02:53:28 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA18583 for current-outgoing; Fri, 15 Aug 1997 02:53:28 -0700 (PDT) Received: from necropolis.org ([207.66.220.160]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA18572 for ; Fri, 15 Aug 1997 02:53:23 -0700 (PDT) Received: from localhost (edmond@localhost) by necropolis.org (8.8.7/8.8.5) with SMTP id CAA06370 for ; Fri, 15 Aug 1997 02:49:17 -0700 (PDT) X-Authentication-Warning: necropolis.org: edmond owned process doing -bs Date: Fri, 15 Aug 1997 02:49:15 -0700 (PDT) From: "Andrew N. Edmond" X-Sender: edmond@necropolis.org To: current@freebsd.org Subject: 3.0: problems with libc_r and native pthreads Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 ::: \-/ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::