kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: kgio@librelist.org
Subject: Re: [PATCH] Don't use deprecated api
Date: Sun, 19 Jan 2014 23:13:32 +0000	[thread overview]
Message-ID: <20140119231332.GA10206@dcvr.yhbt.net> (raw)
In-Reply-To: CAAB-KcnGxkh63FeWz1j3zxeA1GoiEptygHxqBmsDEy5tcENyNw@mail.gmail.com

Hleb Valoshka <375gnu@gmail.com> wrote:
> The patch is almost done (it was tested with mri1.8, 1.9.3 and 2.0),
> but before I finish it, I should ask about correctness of the
> following patch. Is this replacement is correct?

Not exactly, but it actually works...

The FD arg (0, stdin) means Ruby will wake up the polling thread if
that FD is closed, however:

1) poll may not be watching FD=0
2) things tend to break if you trie to close the standard FDs,
   so Ruby (MRI at least) doesn't actually close them

I might be inclined to accept this if there's a comment about the fd=0
being a dummy arg as well as the reasoning of using this function vs
rb_thread_call_without_gvl or rb_thread_blocking_region because the
former is detectable-but-unlinkable in 1.9.3, while the later is
deprecated in 2.x

>  retry:
>  	hash2pollfds(a);
> -	nr = (int)rb_thread_blocking_region(nogvl_poll, a, RUBY_UBF_IO, NULL);
> +	nr = (int)rb_thread_io_blocking_region(nogvl_poll, a, 0);
>  	if (nr < 0) {
>  		if (interrupted()) {
>  			if (retryable(a)) {


  reply	other threads:[~2014-01-19 23:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26 19:57 [PATCH] Don't use deprecated api Hleb Valoshka
2013-12-27  0:19 ` Eric Wong
2014-01-16 23:56 ` Eric Wong
2014-01-17  8:37   ` Hleb Valoshka
2014-01-19 19:42     ` Hleb Valoshka
2014-01-19 23:13       ` Eric Wong [this message]
2014-01-20 19:35         ` Hleb Valoshka
2014-01-20 19:36           ` Hleb Valoshka
2014-01-20 21:12             ` Eric Wong

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

  List information: https://yhbt.net/kgio/

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

  git send-email \
    --in-reply-to=20140119231332.GA10206@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=kgio@librelist.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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).