title: Wait of code execution till event is not done in c#
body: <p>I have c# code which send data frames over the CANBus continuously and CAN read back response from the slave. </p>
  
  <p>I wants to send some 160bytes of data frames to slave continue from c# code. My c# code has the timer of 10ms which read the status from slave whether slave has sent the response back or not. meanwhile the main code continue send 8 bytes of frames to the slave. </p>
  
  <p>Now I want to wait and watch does slave has sent the data back to the master or not, once i got the response i will send the next frame to the salve. </p>
  
  <p>Now in c# how would i do check or wait of code execution does the flag is set or not in the timer .. I tried Thread.Sleep(100); but side effects of this is that timer interrupt function is not executing. similarly I have tried do{}while loop also but same situation.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks
  RakPat </p>