title: How to received proc return data in fileevent
body: <p>I am calling a proc through fileevent. that proc returns a line od data.
  how to receive this data?
  the following code I have written to receive data from pipe when ever data is available. I dont want to block by using direct gets.</p>
  
  <pre><code>proc GetData1 { chan } {
      if {[gets $chan line] &gt;= 0} {
          return $line
      }
  }
  
  proc ReadIO {chan {timeout 2000} } {
      set x 0
      after $timeout {set x 1}
      fconfigure $chan -blocking 0  
  
      fileevent $chan readable [ list GetData1 $chan ] 
      after cancel set x 3
      vwait x
      # Do something based on how the vwait finished...
      switch $x {
         1 { puts "Time out" }
         2 { puts "Got Data" }
         3 { puts "App Cancel" }
         default { puts "Time out2  x=$x" }
      }
      # How to return data from here which is returned from GetData1
  }
  
  ReadIO $io 5000
  
  # ** How to get data here which is returned from GetData1 ? **
  </code></pre>