All of lore.kernel.org
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont <remi@remlab.net>
To: ofono@ofono.org
Subject: Re: RTNL sync or async when creating GPRS Context for STE modem.
Date: Sun, 30 May 2010 22:46:22 +0300	[thread overview]
Message-ID: <201005302246.22317.remi@remlab.net> (raw)
In-Reply-To: <81C3A93C17462B4BBD7E272753C10579169C37B38A@EXDCVYMBSTM005.EQ1STM.local>

[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

Le dimanche 30 mai 2010 17:45:04 Sjur BRENDELAND, vous avez écrit :
> I have started out by doing the RTNL handling async,
> i.e. registering the RTNL socket with g_io_add_watch etc.
> But I'm not really happy with the code as it feels
> unnecessary complex, introduces new states in gprs-context.c. etc.

Using an event loop makes sense if, and only if, the process blocks as far as 
poll() is concerned. If your ioctl() calls or Netlink requests do not enter 
the kernel scheduler at any point, then the glib main loop will just slows 
things down - more code, more context switches.

As an counter example, some people believe so blindly in event loops that they 
use them to read *regular* files, and then recommend it to their friends. 
Nevermind that POSIX states that regular files are always marked ready for 
POLLIN and POLLOUT events, i.e. poll()'ing a regular file will always return 
immediately. Thus the event loop is defeated, and just constitutes useless 
code complexity and wasted CPU time. (Of course, if the same code path can 
cope with non-regular files, then using poll() might make sense, don't make me 
say what I did not.)

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis

  reply	other threads:[~2010-05-30 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-30 14:45 RTNL sync or async when creating GPRS Context for STE modem Sjur BRENDELAND
2010-05-30 19:46 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont [this message]
2010-05-31  7:58   ` Sjur BRENDELAND

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=201005302246.22317.remi@remlab.net \
    --to=remi@remlab.net \
    --cc=ofono@ofono.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.