This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mq' | |
EM.run do | |
def log(*args) | |
p args | |
end | |
amq = MQ.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift File.dirname(__FILE__) + '/../lib' | |
require 'mq' | |
EM.run do | |
# open a channel on the AMQP connection | |
channel = MQ.new | |
# declare a queue on the channel | |
queue = MQ::Queue.new(channel, 'queue name') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require 'rubygems' | |
require 'amqp/lib/mq' | |
EM.run do | |
def log(*args) | |
p args | |
end | |
# AMQP.logging = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
Thread.abort_on_exception = true | |
require 'rubygems' | |
require 'eventmachine' | |
class AsyncTime | |
def self.now | |
EM.add_timer(2){ yield(Time.now) } | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Poor Man's Fiber (API compatible Thread based Fiber implementation for Ruby 1.8) | |
# (c) 2008 Aman Gupta (tmm1) | |
unless defined? Fiber | |
require 'thread' | |
class FiberError < StandardError; end | |
class Fiber | |
def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/fiber18' | |
require 'bacon' | |
class Bacon::Context | |
unless method_defined? :_it | |
alias :_it :it | |
def it *args | |
_it(*args){ if block_given? then yield; Fiber.yield end } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rev' | |
require 'pp' | |
class Google < Rev::HttpClient | |
def self.connect loop = Rev::Loop.default | |
g = super('google.com') | |
g.attach(loop) if loop | |
g | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ConstSetter(opts) | |
(@@__const_setter__modules ||= {})[opts] ||= Module.new do |m| | |
def m.included c | |
@@__const_setter__modules.index(self).each do |key, val| | |
c.const_set(key, val) | |
end | |
end | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- signal.c.orig 2008-08-21 18:42:46.000000000 -0700 | |
+++ signal.c 2008-08-21 18:55:42.000000000 -0700 | |
@@ -23,6 +23,7 @@ | |
#if defined HAVE_SIGPROCMASK || defined HAVE_SIGSETMASK | |
#define USE_TRAP_MASK 1 | |
+static int restore_signals = 0; | |
#else | |
#define USE_TRAP_MASK 0 | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/cmain.cpp b/ext/cmain.cpp | |
index 9890218..c9def4e 100644 | |
--- a/ext/cmain.cpp | |
+++ b/ext/cmain.cpp | |
@@ -103,6 +103,32 @@ extern "C" const char *evma_connect_to_unix_server (const char *server) | |
return EventMachine->ConnectToUnixServer (server); | |
} | |
+/************** | |
+evma_attach_fd |
OlderNewer