Hi Spacix, you're welcome. 3. To yield CPU cycles for the duration of the system tick, a Thread.Sleep(0) is recommended. 4,6. You didn't tell about USB and EE before, I now see why you did what you did. I'm still not convinced there is a need to do it this way tho, AFAIK running timers (i.e. not stopped/disabled) and threads (foreground and background ones) remain active even if you don't have any live references to them any more (except that the last foreground thread reaching its exit will cause app exit). For timers it is well documented; for threads I don't know if/where it is stated explicitly, the only thing I noticed is there is no Thread.Dispose() so I expect the "physical" thread to live on independent of the "logical" Thread object. 7. I would suggest you create a "myUsbDevice" class that encapsulates all relevant code, including the thread stuff, and the dont-interrupt-EE-writing logic. You might give it an IsBusy() or a WaitTillDone() method and give your form a FormClosing event, where you wait until myUsbDevice.IsBusy() returns false or 3 seconds have elasped (easiest is to read DateTime.Now in a yielding loop). :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.