<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -37,13 +37,21 @@ module RB232
       @reader_thread = Thread.new {
         buffer = &quot;&quot;
         while (@stop == false)
-          buffer += @port.read_string(1)
-          messages = buffer.split(@separator,3)
-          if messages.size &gt; 1
-            changed
-            notify_observers(messages[0])
-            buffer = &quot;&quot;
-          end
+          new_string = &quot;&quot;
+          # Read in as much data as possible
+          begin
+            new_string = @port.read_string(255)
+            if (new_string.size &gt; 0)
+              buffer += new_string
+              messages = buffer.split(@separator,2)
+              if messages.size &gt; 1
+                changed
+                notify_observers(messages[0])
+                buffer = messages[1] || &quot;&quot;
+              end
+            end
+          end while (new_string.size &gt; 0 &amp;&amp; @stop == false)
+          sleep(0.5)
         end
       }
     end
@@ -56,4 +64,4 @@ module RB232
 
   end
 
-end
\ No newline at end of file
+end</diff>
      <filename>lib/rb232/text_protocol.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>85b91f82e0f0c733e81adb2b00671ef78d9ad057</id>
    </parent>
  </parents>
  <author>
    <name>James Smith</name>
    <email>james@floppy.org.uk</email>
  </author>
  <url>http://github.com/Floppy/rb232/commit/c3bac991c833dd98a659b3b7d2be10c47cfa39c1</url>
  <id>c3bac991c833dd98a659b3b7d2be10c47cfa39c1</id>
  <committed-date>2008-08-22T01:37:51-07:00</committed-date>
  <authored-date>2008-08-22T01:37:51-07:00</authored-date>
  <message>Change text protocol for non-blocking reads. Read all available data in one go, then sleep a short while until trying again. Reduces CPU load and blocks.</message>
  <tree>71ce6f3e33d8f3bdb7518ccf345a8e685061393a</tree>
  <committer>
    <name>James Smith</name>
    <email>james@floppy.org.uk</email>
  </committer>
</commit>
