|
-
Oct 6th, 2011, 06:50 AM
#10
PowerPoster
Re: how to determine each thread is already finished to run
actually, it still is. a second or two is NOT a long running task AT ALL. in addition, keeping the UI responsive does not necessarily mean spin up another or multiple threads (depends on the context though!)
what you want to do, is batch them up, then send them on a background thread. not a thread per message.
the OP's code snippet for a timer and monitoring 2 threads is also... not entirely efficient and would probably cause more problems. best thing is to batch up the messages into a list, then on the timer, check to see if there are messages to be sent and if so - spin up the thread and send the messages from that thread but making sure that you are using thread safe techniques if you are "inspecting" the list from outside the thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|