Using system; <br/> using system. collections. generic; <br/> using system. LINQ; <br/> using system. text; <br/> using system. threading; </P> <p> namespace multithreading <br/> {<br/> class wait handle <br/> {<br/> Public Delegate int takesawhiledel (INT data, int MS); <br/> static void main (string [] ARGs) <br/>{< br/> // asynchronous DeleGate <br/> takesawhiledel DL = takesawhile; <br/> iasyncresult Re = DL. begininvoke (1, 3000, null, null); </P> <p> while (true) <br/>{< br/> // block the current thread <br/> If (Re. asyncwaithandle. waitone (50, false) <br/>{< br/> console. writeline ("yes"); <br/> break; <br/>}</P> <p> int result = DL. endinvoke (re); <br/> console. writeline ("last result {0}", result. tostring (); <br/> console. readline (); <br/>}</P> <p> static int takesawhile (INT data, int MS) <br/>{< br/> console. writeline ("start to call"); <br/> thread. sleep (MS); <br/> console. writeline ("call completed"); <br/> return + + data; <br/>}< br/>}