[#81492] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — normalperson@...

Issue #13618 has been reported by normalperson (Eric Wong).

12 messages 2017/06/01

[ruby-core:81739] Re: [Ruby trunk Feature#9145][Closed] Queue#pop(true) return nil if empty instead of raising ThreadError

From: Eric Wong <normalperson@...>
Date: 2017-06-22 07:44:26 UTC
List: ruby-core #81739
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 :<

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread