mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul P <ppak_98@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: Re: unexpected extra pollout events from epoll
Date: Sun, 26 Oct 2008 17:58:49 -0700 (PDT)	[thread overview]
Message-ID: <107660.83879.qm@web56306.mail.re3.yahoo.com> (raw)

> You do that by writing data until it's finished, or you
> get EAGAIN. If you
> get EAGAIN, you listen for EPOLLOUT.
> Reading is same, but you'd wait for EPOLLIN.

I've got a few questions about this approach.  The most logical 
way to do this seems to be:

1) Leave the epoll_wait with the EPOLLIN|EPOLLOUT event flags and
 use epoll_ctl to switch the interest mask for each fd between EPOLLIN 
and EPOLLOUT on a per fd basis.

2) When I'm ready to write, I do a write and if it does not fully 
write and I get the EAGAIN flag, I switch the fd with epoll_ctl(fd,MOD,EPOLLOUT). 

However, I get strange behavior when I tried adding fd's with only the 
EPOLLIN interest mask. If I use epoll_wait with both the EPOLLIN and 
EPOLLOUT interest mask, but add fd's with only the EPOLLIN interest mask,
I still seem to get EPOLLOUT events on the fd.

Am I supposed to change the main loop with epoll_wait so that when one 
socket is reading that I switch the main loop to get EPOLLOUT events?  
That means that I'm not receiving on any fd while I'm sending, so this 
probably isn't right.

So, I'm a little confused.

Thanks in advance.

Paul



      

             reply	other threads:[~2008-10-27  0:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-27  0:58 Paul P [this message]
2008-10-27  1:18 ` Davide Libenzi
2008-10-27  1:23   ` Davide Libenzi
2008-10-27  3:48   ` Paul P
     [not found] <fa.iE6LeMsZ2b+Y7nnAUJEFSvwEiiU@ifi.uio.no>
     [not found] ` <fa.KeDEgbYh8k5LzzH6uv7u00N5twU@ifi.uio.no>
2008-10-27  5:59   ` Robert Hancock
     [not found] <fa.YTdIGxaBsWvyaUnxBGIS1f8F2BM@ifi.uio.no>
2008-10-26 16:43 ` Robert Hancock
  -- strict thread matches above, loose matches on Subject: below --
2008-10-26 14:42 Paul P
2008-10-26 22:07 ` Davide Libenzi
2008-10-26 22:48   ` Paul P
2008-10-26 23:12     ` Davide Libenzi

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=107660.83879.qm@web56306.mail.re3.yahoo.com \
    --to=ppak_98@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome