ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81739] Re: [Ruby trunk Feature#9145][Closed] Queue#pop(true) return nil if empty instead of raising ThreadError
Date: Thu, 22 Jun 2017 07:44:26 +0000	[thread overview]
Message-ID: <20170622074426.GA19679@dcvr> (raw)
In-Reply-To: <redmine.journal-65440.20170622072334.2cc3679c55b01450@ruby-lang.org>

glass.saga@gmail.com wrote:
> Issue #9145 has been updated by Glass_saga (Masaki Matsushita).
> 
> Status changed from Feedback to Closed
> 
> Currently, Queue#pop takes non_block flag. 

No, I don't think this should be closed.

I think Justin's point was:

Currently, it is impossible to know if a queue is closed
(permanent condition) or if it is empty (temporary condition).
So at the very least, a different exception should be raised:

Justin Collins wrote:
	> Alternatively, raise an exception that is a subclass of
	> ThreadError with a more specific name, such as "QueueEmpty".
	> This would be a small improvement while remaining compatible
	> with existing code.



On a side note, relying on exceptions for flow control has all
the same performance and $DEBUG noise problems it did with
IO#*_nonblock [ruby-core:38666] [Feature #5138]

But thinking of an efficient API for that is tricky :<

  reply	other threads:[~2017-06-22  7:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24  3:42 [ruby-core:58545] [ruby-trunk - Feature #9145][Open] Queue#pop(true) return nil if empty instead of raising ThreadError jsc (Justin Collins)
2013-11-24  4:30 ` [ruby-core:58546] [ruby-trunk - Feature #9145][Feedback] " Glass_saga (Masaki Matsushita)
2013-11-24  4:42   ` [ruby-core:58547] " Eric Wong
2013-11-25  2:55   ` [ruby-core:58562] " Joel VanderWerf
2013-11-25  0:13 ` [ruby-core:58556] [ruby-trunk - Feature #9145] " jsc (Justin Collins)
2013-11-25  6:17 ` [ruby-core:58564] " drbrain (Eric Hodel)
2017-06-22  7:23 ` [ruby-core:81738] [Ruby trunk Feature#9145][Closed] " glass.saga
2017-06-22  7:44   ` Eric Wong [this message]
2018-01-01 19:41 ` [ruby-core:84576] [Ruby trunk Feature#9145] " uwe

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=20170622074426.GA19679@dcvr \
    --to=ruby-core@ruby-lang.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).