Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Waiting for background thread pattern
Message
De
19/05/2011 10:11:51
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
18/05/2011 22:06:24
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01510997
Message ID:
01511131
Vues:
35
>>Hi all,
>>
>>I am making some changes to an application to help with performance. On the startup currently there are lots of objects and initialization that needs to be performed and currently this is blocking the UI thread. I am moving these things to a Background worker thread so the UI can continue to load and present. The question is I am looking for an appropriate pattern or design that I could implement to know if the user attempts something that requires the Background worker to be done before the worker is completed it would wait. This means either the worker is done and the user action could continue; or the user attempt is waited pending the completion of the worker thread. In addition, if the user exits, I would need to cancel the worker thread if it is still running.
>>
>>I have experimented with a couple of mechanisms but thinking there may already be some design pattern for this.
>
>My pattern is to have a "priority" flag added to my pending tasks, which also includes cancel logic.
>Works well if tasks are short

Thanks Thomas,

Not sure I understand however what you mean by this. Are you suggesting some tasks in some sort of list that you could queue up?
Thanks
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform