title: Posix Serial Connection with Callbacks
body: <p>I am trying to communicate with an arduino using the code from,</p>
  
  <p><a href="http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/" rel="nofollow">http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/</a></p>
  
  <p>which uses termios to open and talk to an arduino in a non blocking way which works fine. What I was wondering is when on Java using rxtx I can register a callback function that is called when ever there is data on the line so that I don't have to manually check. I googled but could not find any info on how to register a callback function?</p>
  
  <p>I am on Linux/OS X and I am trying to avoid launching a new thread just to watch/read data on the line.</p>