HighTechTalks DotNet Forums  

Re: Threading across abstraction layers

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss Re: Threading across abstraction layers in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Chris Tacke, eMVP
 
Posts: n/a

Default Re: Threading across abstraction layers - 07-07-2003 , 11:31 PM






Why not implement a delegate/event that the main thread can implement a
handler on and have the thread raise it when it's done? Othe options would
be a Mutex or other synchronization event.

-Chris


"Ian Williamson" <bmcpeake (AT) nospam (DOT) shaw.ca> wrote

Quote:
Greetings,

You can tell I am nearing the end of my project as I am
now posting all my little bugaboos that I do not have an
answer for.

I am using Merge Replication and I want to pop-up a
window with an animated GIF that executes during the span
of the call to Replicate the data.

Now since I cannot query the state of the thread in CE,
how am I going to know when the call to the Replicate
method is done?

Right now, I will be doing this sort of thing within my
presentation layer:

private void UpdateData()
{
MyDataReplicator myDataReplicator = new MyDataReplicator
();
myPopup popup = new myPopup(); // form with animated GIF
Thread thread = new Thread(new ThreadStart
(myDataReplicator.Replicate()));
thread.Start();
popup.Show();
while (true)
{
popup.Update(); // animate next frame of GIF
sleep(1000);
*** something here to check state of "thread" to see
if it has completed execution - if true, break
}
popup.Dispose();
myDataReplicator.Displose();


Also, what are the best practices for disposing of a
thread like this once it has completed?

Note that I do not want to use Invoke to update my GUI
from the delegate thread as it is in my Data Tier and
making such a callback would really muck up my
abstraction model.


Cheers, Ian Williamson





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.