<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,6 @@
 spec = Gem::Specification.new do |s|
   s.name = 'em-mysql'
-  s.version = '0.3.0'
+  s.version = '0.4.0'
   s.date = '2009-06-23'
   s.summary = 'Async MySQL client API for Ruby/EventMachine'
   s.email = &quot;em-mysql@tmm1.net&quot;
@@ -8,7 +8,7 @@ spec = Gem::Specification.new do |s|
   s.description = 'Async MySQL client API for Ruby/EventMachine'
   s.has_rdoc = false
   s.authors = [&quot;Aman Gupta&quot;]
-  s.add_dependency('eventmachine', '&gt;= 0.12.8')
+  s.add_dependency('eventmachine', '&gt;= 0.12.9')
 
   # git ls-files
   s.files = %w[</diff>
      <filename>em-mysql.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,8 @@ class EventedMysql &lt; EM::Connection
     @connected = true
 
     log 'mysql connected'
-    make_socket_blocking
+
+    self.notify_readable = true
     EM.add_timer(0){ next_query }
   end
   attr_reader :processing, :connected, :opts
@@ -109,7 +110,8 @@ class EventedMysql &lt; EM::Connection
       @mysql = EventedMysql._connect @opts
       @fd = @mysql.socket
 
-      @signature = EM.attach_fd @mysql.socket, true, false
+      @signature = EM.attach_fd @mysql.socket, true
+      EM.set_notify_readable @signature, true
       log 'mysql connected'
       EM.instance_variable_get('@conns')[@signature] = self
       @connected = true
@@ -157,25 +159,11 @@ class EventedMysql &lt; EM::Connection
   
   def close
     @connected = false
-    # @mysql.close
-    # IO.pipe
-    # EM.add_timer(0){ close_connection }
-    # close_connection
     fd = detach
-    @io.close if @io
-    @io = nil
     log 'detached fd', fd
   end
 
   private
-  
-  def make_socket_blocking
-    if defined?(Fcntl::F_GETFL)
-      @io = IO.for_fd(@mysql.socket)
-      m = @io.fcntl(Fcntl::F_GETFL, 0)
-      @io.fcntl(Fcntl::F_SETFL, ~Fcntl::O_NONBLOCK &amp; m)
-    end
-  end
 
   def next_query
     if @connected and !@processing and pending = @@queue.shift
@@ -192,12 +180,12 @@ class EventedMysql &lt; EM::Connection
   public
 
   def self.connect opts
-    unless EM.respond_to?(:attach) and Mysql.method_defined?(:socket)
-      raise RuntimeError, 'mysqlplus and EM.attach are required for EventedMysql'
+    unless EM.respond_to?(:watch) and Mysql.method_defined?(:socket)
+      raise RuntimeError, 'mysqlplus and EM.watch are required for EventedMysql'
     end
 
     if conn = _connect(opts)
-      EM.attach conn.socket, self, conn, opts
+      EM.watch conn.socket, self, conn, opts
     else
       EM.add_timer(5){ connect opts }
     end</diff>
      <filename>lib/em/mysql.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cdd1648a785c717bf2c4a1580e59a7da3cc48eb9</id>
    </parent>
  </parents>
  <author>
    <name>Aman Gupta</name>
    <email>aman@tmm1.net</email>
  </author>
  <url>http://github.com/tmm1/em-mysql/commit/6f63519d75fddd109261a65a2d75bb0cad2a60bd</url>
  <id>6f63519d75fddd109261a65a2d75bb0cad2a60bd</id>
  <committed-date>2009-08-24T12:18:24-07:00</committed-date>
  <authored-date>2009-08-24T12:18:24-07:00</authored-date>
  <message>Use EM.watch in favor of IO/blocking hacks</message>
  <tree>62cbfe0c75bccd2cbb857f2613ab8531b8cbbe84</tree>
  <committer>
    <name>Aman Gupta</name>
    <email>aman@tmm1.net</email>
  </committer>
</commit>
