Does the GIL Make Your Ruby Code Thread-Safe? - 1 views
-
Jozef Fulop on 26 Jun 13out of 5 dentists agree that multi-threaded programming is hard to get right. At the end of the day, all that the GIL guarantees is that MRI's native C implementations of Ruby methods will be executed atomically (but even this has caveats). ... So the GIL doesn't 'solve' thread-safety issues. ... One way that we work with hard problems is with good abstractions. ... We're seeing more and more abstractions around threads. An approach that's catching on in the Ruby community is the Actor model of concurrency, with the most popular implementation being Celluloid. Celluloid provides a great abstraction that marries concurrency primitives to Ruby's object model. Celluloid can't guarantee that your code will be thread-safe or free from race conditions, but it wraps up best practices. I encourage you give Celluloid a try.