|
-
Feb 27th, 2004, 04:50 PM
#1
Thread Starter
Member
suspend Background thread
What is the correct way to suspend a background thread that is on a 15 sec delay interval. This thread is instantiated and started on the main UI. Dont' have a seperate class. Right now when a user clicks on a button to activate a form to find a personnel or address I suspend the thread immediatly by raising an event, before that I just did mythread.suspend. After the function call is done or the child form is closed and disposed of I resume the thread by raising the event again. Anybody have any suggestions to make my amp run a little smoother. and not so choppy.
-
Feb 27th, 2004, 05:13 PM
#2
Why do you need threading?
Try showing the form via the ShowDialog method instead of Show or did I misunderstand the situation?
-
Feb 27th, 2004, 06:51 PM
#3
Thread Starter
Member
Yeah, sorry. I've got that background thread that retrieves some personnel data including their GPS coordinates as they are posted to our servers and then maps it to Mappoint 2004. The back-end is sql 2000 Pretty much making a map interface that displays our service guys. So I thought the best way to do this was to use a thread so the user doesn't have to keep on pressing a refresh button.
So the app is running and the thread is refreshing the pushpins on the map, and moving them as the GPS coordinates change. The user wants to find a property or personnel so they click that button. Right at that moment I'm guesing I should suspend my background thread so the UI is more responsive and I'm also retireving more data from the DB which would be benificial too.
So what is the correct way I should suspend my thread.
-
Feb 27th, 2004, 07:24 PM
#4
I think the bigger issue is that there is only one UI thread which is the main thread of the app so regardless of whether or not any processing is down on the back thread it must be marshalled to the UI/Main thread in order to be seen and this causes unresponsiveness when done too frequently. This is because although the UI will be responsive when the actual processing is going on in the backthread once it goes to update the UI this will stall the UI thread making it unresponsive while updating. You can use Suspend/ResumeLayout to minimize the effects or some API calls to lock updates for other windows but depending on how much is being updated there may still be lag.
Last edited by Edneeis; Feb 27th, 2004 at 07:27 PM.
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
|