http://d.puremagic.com/issues/show_bug.cgi?id=5157


Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schvei...@yahoo.com
         Resolution|                            |INVALID


--- Comment #1 from Steven Schveighoffer <schvei...@yahoo.com> 2010-11-03 
07:55:06 PDT ---
The original code looks correct to me.  Rewritten in pseudocode:

while(true)
{
   nonDaemon = null;
   assign nonDaemon to first non-daemon thread in the list of threads;
   if(nonDaemon not found)
     // this means there are no non-daemon threads left
     return;
   nonDaemon.join();
}

The reason it is done this way instead of the way you suggest is because the
foreach is synchronized on a lock (to prevent threads coming/going while
iterating).  So you don't want to call join while inside the foreach loop.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to