From: Tony Arcieri Date: 2011-10-26T01:41:59+09:00 Subject: [ANN] celluloid 0.5.0: easy-to-use concurrent objects for Ruby Celluloid provides a simple and natural way to build fault-tolerant concurrent programs in Ruby. With Celluloid, you can build systems out of concurrent objects just as easily as you build sequential programs out of regular objects. Recommended for any developer, including novices, Celluloid should help ease your worries about building multithreaded Ruby programs. - RDoc: http://celluloid.github.com/ - Github: http://github.com/tarcieri/celluloid Celluloid wraps objects in threads, allowing them to run concurrently, while still letting you talk to them using standard Ruby method call conventions. It also enables asynchronous method calls which tell a method to do something in the background, and futures, which let you request a method be executed then check back later for the result. My blog has more information on Celluloid: http://www.unlimitednovelty.com/2011/09/object-oriented-concurrency-deep-dive.html http://www.unlimitednovelty.com/2011/05/introducing-celluloid-concurrent-object.html -- Version 0.5.0 includes some awesome new features as well some performance improvements refactoring of the internals. Celluloid now uses a simple thread pool to improve the performance of short-lived actors. This release introduces a backwards incompatible change in Celluloid's API. Previous releases of Celluloid let you define actors by including Celluloid::Actor directly. This is no longer supported. Please define actors using "include Celluloid": class MyActor include Celluloid ... end Please define actors as bove. Using "include Celluloid::Actor" will now cause errors. Version 0.5.0 also introduces Celluloid::IO, which allows you to define actors which make blocking I/O operations but still process messages in the meantime. Celluloid::IO is an alternative implementation of actors designed to allow them to multiplex both incoming messages an IO objects. To wait on an IO object to become readable or writeable, use the Celluloid::IO#wait_readable and #wait_writeable methods respectively. These methods will still allow the actor to respond to messages in the meantime. The following class shows the usage of wait_readable and now ships with Celluloid as Celluloid::TCPServer: class TCPServer include Celluloid::IO # Bind a TCP server to the given host and port def initialize(host, port) @server = ::TCPServer.new host, port run! end # Run the TCP server event loop def run while true wait_readable(@server) { on_connect @server.accept } end end # Terminate this server def terminate @server.close super end # Called whenever a new connection is opened def on_connect(connection) connection.close end end -- Full changelog follows: * "include Celluloid::Actor" no longer supported. Use "include Celluloid" * New Celluloid::IO module for actors that multiplex IO operations * Major overhaul of Celluloid::Actor internals (see 25e22cc1) * Actor threads are pooled in Celluloid::Actor::Pool, improving the speed of creating short-lived actors by over 2X * Classes that include Celluloid now have a #current_actor instance method * Celluloid#async allows actors to make indefinitely blocking calls while still responding to messages * Fix a potential thread safety bug in Thread#mailbox * Experimental Celluloid::TCPServer for people wanting to write servers in Celluloid. This may wind up in another gem, so use at your own risk! * Magically skip ahead a few version numbers to impart the magnitude of this release. It's my versioning scheme and I can do what I wanna. -- Tony Arcieri