Hi

To keep alive i´d suggest that your method "StartWorking" should never return.
May be you can try some Thread.Sleep(TimeSpan.Infinite) or something similar.

Or maybe just put the Sleep in your ThreadStart Method.

(always assuming it´s really just keeping a thread alive what you want)

a


 

> -----Original Message-----
> From: Discussion of advanced .NET topics. 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Alexander Herrmann
> Sent: Mittwoch, 17. Mai 2006 12:59
> To: [email protected]
> Subject: [ADVANCED-DOTNET] Windows.Forms.Form + Threading
> 
> Hi there,
> 
> I need an advice for threading with windows.forms aso.
> I got a little Windows.Forms application, after starting it I 
> have to instantiate some other classes (no forms classes) 
> that have to run in a seperate thread and - the most 
> important thing: this classes have to be kept alive as they 
> are using some timers that frequently check some data from 
> the operating system. The problem is when I create a new 
> thread and set a method as starting point that instantiates 
> this classes aso the thread is closed after the 
> instantiating, there is no reaction on the event handlers of 
> the instantiates classes. How can I keep the Thread alive?
> 
> I tried it like this:
> 
> Thread t = new Thread(new ThreadStart(ThreadJob)); 
> t.IsBackground = true; t.Start();
> 
> ...
> 
> void ThreadStart()
> {
> Job1 j1 = new Job1();
> j1.StartWorking();
> ...
> }
> 
> Thanks in advance!
> 
> ===================================
> This list is hosted by DevelopMentor®  http://www.develop.com
> 
> View archives and manage your subscription(s) at 
> http://discuss.develop.com
> 

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to