Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Termination of Worker/Child thread terminates the Parent Thread

Reply
Thread Tools

Termination of Worker/Child thread terminates the Parent Thread

 
 
Sanjay
Guest
Posts: n/a
 
      02-20-2007
Hi All

Have an app. On start up it creates a thread and goes to sleep.
Either on termination or completion of the worker thread, it triggers
the main app to start executing.

Question

Why is the completion of the worker/child thread triggering the
execution of the main app thread. Shouldn't the main app thread remain
in the suspended state?


Module Module1

Sub Main()


Dim connStr As ConnectionStringSettings = Nothing
Dim myConfigReader As Config = New TMISSuite.Config

' Start TMISManager
Console.WriteLine(System.DateTime.Now() + " Starting Manager
Thread")

Dim myManager As TMISManager = New
TMISManager(connStr.ToString())
Dim myThread As New Thread(AddressOf
TMISManager.StartTMISManager)
myThread.Start()


Thread.Sleep(0)


Console.WriteLine("About to exit main app")




End Sub

End Module


Thanks in advance

regards
Sanjay

 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      02-21-2007
That is new behavior in .NET 2.0
If you had an unhandled exception in worker thread .NET unloads the whole
domain

Always wrap your wroking funtcion into try..catch

George.



"Sanjay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi All
>
> Have an app. On start up it creates a thread and goes to sleep.
> Either on termination or completion of the worker thread, it triggers
> the main app to start executing.
>
> Question
>
> Why is the completion of the worker/child thread triggering the
> execution of the main app thread. Shouldn't the main app thread remain
> in the suspended state?
>
>
> Module Module1
>
> Sub Main()
>
>
> Dim connStr As ConnectionStringSettings = Nothing
> Dim myConfigReader As Config = New TMISSuite.Config
>
> ' Start TMISManager
> Console.WriteLine(System.DateTime.Now() + " Starting Manager
> Thread")
>
> Dim myManager As TMISManager = New
> TMISManager(connStr.ToString())
> Dim myThread As New Thread(AddressOf
> TMISManager.StartTMISManager)
> myThread.Start()
>
>
> Thread.Sleep(0)
>
>
> Console.WriteLine("About to exit main app")
>
>
>
>
> End Sub
>
> End Module
>
>
> Thanks in advance
>
> regards
> Sanjay
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot read from Runtime.getRuntime().exec().getErrorStream because process terminates Zsolt Koppany Java 2 03-05-2011 05:51 PM
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
"warning: fork terminates thread" Hal Fulton Ruby 2 06-21-2004 02:08 PM
Cisco Router to VPN 3000 Tunnel Terminates Every 10 minutes or so. HELP! Rick B. Cisco 3 01-16-2004 04:53 PM
VPN terminates on pix 501...but i cannot access windows 2000 vpn server Warren Turner Cisco 0 01-09-2004 08:28 PM



Advertisments