Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a project that runs in its own thread
Message
 
To
20/08/2008 11:20:37
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01340388
Message ID:
01340478
Views:
8
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform