Re:EventMachine: scalable non-blocking i/o in ruby
by jrockway on Monday March 15, 2010 @06:23PM
(#1194308)
Coro basically allows you to write:
foo();
bar();
instead of:
foo( cb => sub { bar() } );
Behind the scenes, it's basically the same thing. It's cooperative so your code does not get preempted where you don't want it to be; the locking is implicit.
But you can switch to preemption and explicit locking if you desire. At that point, IMO, it's time to ditch Perl / Python / Ruby and use a language with a sane STM implementation, because locks suck.
But you can switch to preemption and explicit locking if you desire. At that point, IMO, it's time to ditch Perl / Python / Ruby and use a language with a sane STM implementation, because locks suck.