From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,76254c320612b8c2,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-06-19 08:49:59 PST Path: archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mail From: shvakeda@yahoo.com (Greg P) Newsgroups: comp.unix.tru64 Subject: popen and threads: I'm really perplexed. Date: 19 Jun 2001 08:49:58 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 167.76.159.227 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 992965799 9737 127.0.0.1 (19 Jun 2001 15:49:59 GMT) X-Complaints-To: groups-support@google.com NNTP-Posting-Date: 19 Jun 2001 15:49:59 GMT Xref: archiver1.google.com comp.unix.tru64:2562 Hello, I've written a program that creates a posix thread which then uses popen to execute a shell command (like "ps" for instance). popen is executing just fine. I then use fgets to read the output of the shell command inside the thread. The problem is, the fgets call is getting an EWOULDBLOCK error. perror is printing the message "system call interrupted". What in the world is going on here? I've created the thread to do the "blocking" calls (like reading the output from popen) so that my main application is not blocked. I've tried modifying the thread's scheduling attributes to no avail. The maddening thing about this, is that the thread creation and popen calls are encapsulated in one "spawn" routine that I've written. I created a test program for this routine and the test works perfectly. When I call the "spawn" routine inside of another (far more complex) program, I get this weird failure. Any help on this one would be incredibly appreciated. Greg