home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,391 of 33,346   
   Marc to Saeed Amrollahi Boyouki   
   Re: To join threads a couple of times   
   17 Aug 11 17:31:27   
   
   4fa10e45   
   From: marc.glisse@gmail.com   
      
   Saeed Amrollahi Boyouki  wrote:   
      
   > Is it valid to join two threads more than one time?   
      
   No.   
      
   >  std::thread t{f};   
   >  t.join();   
   >  t.join();   
      
   >From the standard:   
   bool joinable() const noexcept;   
     Returns: get_id() != id()   
   void join();   
     Requires: joinable() is true.   
     Postconditions: The thread represented by *this has completed. get_id() ==   
   id().   
      
   You may want to check joinable() before calling join(). In what   
   circumstances do you want to potentially join multiple times?   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca