B
barker7
In our app, we need to collect data at regular intervals (4, 8 or 16
seconds - user settable). The collection happens in a background
thread. My first approach was to do the collection, which takes about
0.5 seconds, then calculate how much time to sleep until the next
collection.
The problem is that when I cancel the collection, I have to wait for it
to emerge from the sleep before it actually exits. I could call
thread.Abort, but that seems frowned up.
A second approach is to have the collection loop wait for an event.
The event could be signalled from a Threading.Timer object or from the
user request.
Can I have your opinion on either of these approaches, or any othe
suggestions?
Thanks
Mitch
seconds - user settable). The collection happens in a background
thread. My first approach was to do the collection, which takes about
0.5 seconds, then calculate how much time to sleep until the next
collection.
The problem is that when I cancel the collection, I have to wait for it
to emerge from the sleep before it actually exits. I could call
thread.Abort, but that seems frowned up.
A second approach is to have the collection loop wait for an event.
The event could be signalled from a Threading.Timer object or from the
user request.
Can I have your opinion on either of these approaches, or any othe
suggestions?
Thanks
Mitch