[concurrency-interest] Termination of daemon threads

Rémi Forax forax at univ-mlv.fr
Tue Apr 1 03:04:48 EDT 2008


Richard Zschech a écrit :
> Couldn't you go setDaemon(false) / setDaemon(true) around your critical
> sections?
>   
setDeamon() can't be called after the thread starts.
http://download.java.net/jdk7/docs/api/java/lang/Thread.html#setDaemon(boolean)

Rémi
> >From Richard.
>
>
> -----Original Message-----
> From: concurrency-interest-bounces at cs.oswego.edu
> [mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of David
> Holmes
> Sent: Tuesday, 1 April 2008 3:12 PM
> To: jim.andreou at gmail.com; concurrency-interest at cs.oswego.edu
> Subject: Re: [concurrency-interest] Termination of daemon threads
>
> A daemon thread should never do anything critical. Daemon threads just
> "vanish" when the process is terminated. Though for Sun's VM they are at
> least brought to a system "safe-point" first - though executing native
> code
> is considered being at a "safe-point" ie outside of the VM.
>
> It probably could be documented better.
>
> David Holmes
>
>   
>> -----Original Message-----
>> From: concurrency-interest-bounces at cs.oswego.edu
>> [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of
>>     
> Dimitris
>   
>> Andreou
>> Sent: Tuesday, 1 April 2008 2:02 PM
>> To: concurrency-interest at cs.oswego.edu
>> Subject: [concurrency-interest] Termination of daemon threads
>>
>>
>> Hi all,
>>
>> Here is my question: How are daemon threads terminated? What if they
>>     
> are
>   
>> in the middle of a critical operation, like writing to a file? They
>>     
> seem
>   
>> to exit immediately. How could that be safe? Or a daemon thread should
>> never do anything critical, but always delegate such work to a
>> non-daemon thread? If any case, shouldn't it be documented in
>> java.lang.Thread?
>>
>> Thanks
>> Dimitris Andreou
>>
>> _______________________________________________
>> Concurrency-interest mailing list
>> Concurrency-interest at altair.cs.oswego.edu
>> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>>
>>     
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
> !DSPAM:1,47f1c9bc745732238521400!
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>   



More information about the Concurrency-interest mailing list