Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a project that runs in its own thread
Message
 
À
20/08/2008 11:20:37
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01340388
Message ID:
01340478
Vues:
9
>Hi all,
>
>I have a project in my solution that is a wrapper class around a third party product. I want this entire project to run in it's own thread. I understand threading but not sure how to get the whole project in its own thread. I don't want to do this in the using application.
>
>I have one primary class in this project and some supporting classes.
>Thanks for any helpful direction.
>Thanks
>Tim

If you have one "main" entrypoint into that other project you can do this either in the calling application (or, what I think you want) in the project itself. Just move the startup code into another method and replace the startup code with a new thread call to that other method:
public static System.Threading.Thread AppThread { get; set; }

public void MainEntry()
{
    AppThread = new System.Threading.Thread(new System.Threading.ThreadStart(CodeThatUsedToBeInMainEntry));
    AppThread.Start();

}

public void CodeThatUsedToBeInMainEntry()
{
   // Do something
}
All the code should then be running in the new thread.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform