{"id":16068027,"url":"https://github.com/ged/io-reactor","last_synced_at":"2026-03-07T13:03:07.139Z","repository":{"id":637306,"uuid":"278629","full_name":"ged/io-reactor","owner":"ged","description":"A multiplexed, single-threaded, event-driven IO reactor","archived":false,"fork":false,"pushed_at":"2011-01-21T19:29:35.000Z","size":353,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T17:23:50.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://deveiate.org/projects/IO-Reactor","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ged.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-08-15T12:32:08.000Z","updated_at":"2021-11-29T00:10:00.000Z","dependencies_parsed_at":"2022-07-07T13:40:42.740Z","dependency_job_id":null,"html_url":"https://github.com/ged/io-reactor","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fio-reactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fio-reactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fio-reactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fio-reactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ged","download_url":"https://codeload.github.com/ged/io-reactor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244164812,"owners_count":20408990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T06:07:59.737Z","updated_at":"2026-03-07T13:03:02.119Z","avatar_url":"https://github.com/ged.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# io_reactor\n\n* http://deveiate.org/projects/IO-Reactor\n\n## Description\n\nAn implementation of the Reactor design pattern for multiplexed asynchronous single-thread IO.\n\nThis module is a pure-Ruby implementation of an asynchronous multiplexed IO Reactor which is based on the Reactor design pattern found in _Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects_. It allows a single thread to demultiplex and dispatch events from one or more IO objects to the appropriate handler.\n\n### Trivial Example\n\nThis is a very trivial example -- in most circumstances you'd only use a Reactor when you're trying to manage reading and writing on more than a single IO object.\n\n\trequire 'io/reactor'\n\t\n\treactor = IO::Reactor.new\n\tdata_to_send = \"some stuff to send\"\n\t\n\treader, writer = IO.pipe\n\t\n\t# Read from the reader end of the pipe until the writer finishes\n\treactor.register( reader, :read ) do |io,event|\n\t    if io.eof?\n\t        reactor.unregister( io )\n\t        io.close\n\t    else\n\t        puts io.read( 256 )\n\t    end\n\tend\n\t\n\t# Write to the writer end of the pipe until there's no data left\n\treactor.register( writer, :write ) do |io,event|\n\t    bytes = io.write( data_to_send )\n\t    data_to_send.slice!( 0, bytes )\n\t\n\t    if data_to_send.empty?\n\t        reactor.unregister( io )\n\t        io.close\n\t    end\n\tend\n\t\n\t# Now pump the reactor until both sides are done\n\tputs \"Starting IO\"\n\treactor.poll until reactor.empty?\n\tputs \"done, exiting.\"\n\nSee the examples/ directory for some working, more full-featured examples.\n\n\n## Installation\n\n    gem install io-reactor\n\n\n## Contributing\n\nYou can check out the current development source with Mercurial like so:\n\n    hg clone http://repo.deveiate.org/IO-Reactor\n\nOr if you prefer Git, via its Github mirror:\n\n    https://github.com/ged/io-reactor\n\nAfter checking out the source, run:\n\n\t$ rake newb\n\nThis task will install any missing dependencies, run the tests/specs, and generate the API documentation.\n\n\n## License\n\nCopyright (c) 2002-2011, Michael Granger\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the author/s, nor the names of the project's\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fio-reactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fged%2Fio-reactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fio-reactor/lists"}