Review Board 1.7.22


Keep better track of threads avoiding deadlocks at process rundown

Review Request #904 - Created June 15, 2011 and discarded

Steve Huston
QPID-3256
Reviewers
qpid
qpid
Keeps track of Qpid runnable threads and other threads, ensuring that rundown doesn't deadlock.
Qpid regression test suite.
Posted (June 16, 2011, 12:56 p.m.)

   

  
On linux this should be a PODMutex to ensure it is statically initialized before any possible use. Don't know if that's the case on Windows.
Why the pointer? Just declare 

std::map<unsigned, ThreadPrivate::shared_ptr> pQpidThreads;

and let std::map take care of the memory management. 
  1. I'd also add that we don't use the hungarian variable notation either so the 'p' should be stripped (possibly from other places too)
  2. OK... this was previously invisible because I missed the <Publish> step :-(
    
    The intended logic was that Thread::current() should have defined behavior, even if called from a static destructor.  Otherwise, you need a way to guarantee the std:map destructor is never called too soon.
    
    The original JIRA's deadlock was in the context of a static destructor calling Thread::join().
    
    On re-examiniation, the use of a non-POD lock mechanism is inconsistent with the stated goal.  Thank-you for the heads up.  I will work with Steve to address this and the naming problem.
    
    I have a fixed version I will upload to a separate review... coming soon.
Posted (July 1, 2011, 11:46 a.m.)
This was continued in a separate review request, https://reviews.apache.org/r/987/