Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: shvakeda@yahoo.com (Greg P)
Subject: popen and threads: I'm really perplexed.
Date: 19 Jun 2001 08:49:58 -0700	[thread overview]
Message-ID: <c986d0ea.0106190749.6c577d95@posting.google.com> (raw)

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


                 reply	other threads:[~2001-06-19 15:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox