linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn.clements@virgin.net>
To: "William N. Zanatta" <william@veritel.com.br>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: select() and pipes
Date: Thu, 28 Nov 2002 15:31:01 +0000	[thread overview]
Message-ID: <15846.14005.704447.246508@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <3DE62CCE.2070003@veritel.com.br>


William N. Zanatta wrote:

>    I'm writing a tiny program which gets its input from a pipe. It works 
> with apache like in this example...
> 
> ------ httpd.conf-------
> 
>    CustomLog "|/path/my/bin"
> 
> ------ httpd.conf-------
> 
>    On apache2 it works pretty well but on 1.3 series I'm experiencing 
> some problemas and one of them is the CPU Load. The program's main() 
> used to live in a infinite loop making a fgets() and checking for data 
> availability on the returned buffer.
> 
>    Well, guessing this is the main reason for the CPU Load, I started 
> with select() to check for data availability and I've found that the 
> couple select() and the pipe as stdin will always return a ready to read 
> status even if there's no data to be read.

How exactly are you using select()? Are you initialising the fd_set
correctly? Are you specifying a timeout?

Is there any reason why you can't just perform blocking reads?

-- 
Glynn Clements <glynn.clements@virgin.net>

      reply	other threads:[~2002-11-28 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-28 14:48 select() and pipes William N. Zanatta
2002-11-28 15:31 ` Glynn Clements [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15846.14005.704447.246508@cerise.nosuchdomain.co.uk \
    --to=glynn.clements@virgin.net \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=william@veritel.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).