In G1 there are many places where code is bracketed by calls to SuspendibleThreadSet::join() and SuspendibleThreadSet::leave() (and vice versa).
It'd be helpful to introduce two classes that automatically ensure that the appropriate action is taken at the start and end of such a critical section using the standard idiom of calling the appropriate method in the constructor and destructor of each class (similar to how MutexLocker / MutexUnlocker work).
            
It'd be helpful to introduce two classes that automatically ensure that the appropriate action is taken at the start and end of such a critical section using the standard idiom of calling the appropriate method in the constructor and destructor of each class (similar to how MutexLocker / MutexUnlocker work).
- duplicates
- 
                    JDK-8079579 Add SuspendibleThreadSetLeaver and make SuspendibleThreadSet::joint()/leave() private -           
- Resolved
 
-         
- relates to
- 
                    JDK-8039147 Cleanup SuspendibleThreadSet -           
- Resolved
 
-