How to execute a blocking function that returns a value for a maximum amount of time in Java.

Posted by gamernb on Stack Overflow See other posts from Stack Overflow or by gamernb
Published on 2010-04-28T00:17:30Z Indexed on 2010/04/28 0:23 UTC
Read the original article Hit count: 341

Filed under:
|

How would I go about making a function that would do this in java.

String result = null

do
{
  SendData()

  // Run Blocking Function: ReceiveData() Until it returns a result
  // or t seconds have elapsed

  // if something returned, result = something
  // else result = null

} while(result == null);

© Stack Overflow or respective owner

Related posts about java

Related posts about threads