Project

General

Profile

Actions

Feature #10052

closed

Add parameter non_block (defaults to false) on SizedQueue#push

Added by herwinw (Herwin Quarantainenet) almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:63794]

Description

The implementations of Queue and SizedQueue have a method pop, where a parameter non_block would make the call raise a ThreadError if the queue is empty. Since popping of an empty queue is comparable with pushing to a full SizedQueue, I guess it would be nice to have an optional second parameter to make SizedQueue#push optional non-blocking too.


Files

ruby10052_sized_queue_push_nonblock.diff (2.03 KB) ruby10052_sized_queue_push_nonblock.diff herwinw (Herwin Quarantainenet), 07/17/2014 09:49 AM

Updated by herwinw (Herwin Quarantainenet) almost 10 years ago

The following patch should do the trick.

Another thing to consider in this file: don't mix up tabs and spaces. The indention is completely gone when viewing with a tabstop < 8.

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46852.


thread/thread.c: non-blocking push on SizedQueue

  • ext/thread/thread.c (rb_szqueue_push): add optional parameter,
    non_block defaulted to false. [ruby-core:63794] [Feature #10052]
Actions

Also available in: Atom PDF

Like0
Like0Like0