New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

queue_ding

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queue_ding

  • 0.1.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= QueueDing alternative to Queue {Join the chat at https://gitter.im/flajann2/queue_ding}[https://gitter.im/flajann2/queue_ding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge] {Build Status}[https://travis-ci.org/flajann2/queue_ding?branch=master]

== Gem Version {Gem Version}[http://badge.fury.io/rb/queue_ding] {}[https://travis-ci.org/flajann2/queue_ding]

This roughly mirrors the functionaly of Queue in allowing you to queue messages to one or more threads, and will block if the queue is empty, waking up when there is another message available.

Because this is derived directly from the Array class, it has all the expected Array functionality, with the appropriate wrappers for thread safety.

Like Queue, QueueDing is a FIFO queue.

== New Funtionality === v0.1.0 Automatic tee support added, so that multiple listening threads will get the same data. There is currenly no way to turn this feature off. If this is a problem for you, let me know and I'll add a switch sooner.

You may not want this behavior if you are using queue_ding to distrubute work among listening threads, but you will want this if you need to ensure multile listeners receive the smae data, as in the case with with my dyamic interfaces for browser-based Dashboards.

== Known Issues === v0.1.0 With the new Automatic Tee Feature, there is currently no cleanup for dead threads. This could potentially lead to a memory leak situation for long running tasks. This problem will be addressed later.

== Usage

== Examples

This is taken from the rspec tests.

require 'queue_ding'
include QueueDing

queue = QDing.new

tout = Thread.new do
  (0..1000).each{ |j|
    (i, num) = @queue.next
    expect(j).to eq i
    expect(num).to eq j * 7 + 3
  }
end

tin = Thread.new do
  (0..1000).map{|i| [i, i * 7 + 3]}.each{|pair| @queue << pair }
end

tin.join
tout.join

== Changelog

v0.1.0 2014-08-03 Added tee capability so that you can tee queue to multiple threads automatically. There are no settings for this. It just works. For some, this behavior may be undesirable, so an option will be added at a later date.

== Copyright

Copyright (c) 2014 Fred Mitchell. See LICENSE.txt for further details.

== Contributing to queue_ding

I am very open to any ideas you may have for new features you may want to see, any pull requests, etc.

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Why I Created QueueDing

I ran into an issue with Queue segfaulting on Ruby 2.1.1 and 2.1.2. I need this for my RubyNEAT project and simply has to work. Like deep_dive, this is driven by the RubyNEAT effort, which will be quite stringent. So expect to see further improvements and enhancements as the needs arise.

== Funny Trivia

"Queue Ding" is actually German for "Queue Thing", so it is my hopes my German compatriots will forgive me for any possible faux pas this might entail.

== Copyright

Copyright (c) 2014 Fred Mitchell. See LICENSE.txt for further details.

FAQs

Package last updated on 22 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc