Patryk
Patryk

Reputation: 3152

Do children threads die after parent's thread death?

I'm working on a multi-threaded program and I'm not sure about this.

Upvotes: 1

Views: 3348

Answers (2)

spender
spender

Reputation: 120518

No, but threads marked as IsBackground will die when their hosting process is terminated, whereas if IsBackground is false, they will prevent the process from terminating until they are finished.

Upvotes: 8

Ameen
Ameen

Reputation: 2586

A background thread will only be terminated when all foreground threads finish if its IsBackground property is set to true. I'm assuming we're talking .NET :)

http://msdn.microsoft.com/en-us/library/system.threading.thread.isbackground.aspx

Upvotes: 2

Related Questions