Axel Coon
Axel Coon

Reputation: 85

Is a user thread spawned by a daemon thread continue to live after all other user threads are completed?

By documentation:

If all users thread are completed, all daemon threads are abruptly stopped and program is over, and until at least 1 user thread is alive the program is alive.

So the intuitive answer on my question: "Is a user thread spawned by a daemon thread continue to live after all other user threads are completed?" is: it continues to live.

But I heard the contrary opinion, help, please

Upvotes: 0

Views: 48

Answers (1)

M A
M A

Reputation: 72884

Yes, a non-daemon thread continues running if other non-daemon threads are finished. It is irrelevant as to how the non-daemon thread was created, i.e. whether the creating thread was daemon or not.

Upvotes: 3

Related Questions