mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
6988353: refactor contended sync subsystem
Reduce complexity by factoring synchronizer.cpp Reviewed-by: dholmes, never, coleenp
This commit is contained in:
parent
daa052114f
commit
22929fb78f
29 changed files with 4556 additions and 4792 deletions
|
@ -265,48 +265,3 @@ class Mutex : public Monitor { // degenerate Monitor
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Per-thread blocking support for JSR166. See the Java-level
|
||||
* Documentation for rationale. Basically, park acts like wait, unpark
|
||||
* like notify.
|
||||
*
|
||||
* 6271289 --
|
||||
* To avoid errors where an os thread expires but the JavaThread still
|
||||
* exists, Parkers are immortal (type-stable) and are recycled across
|
||||
* new threads. This parallels the ParkEvent implementation.
|
||||
* Because park-unpark allow spurious wakeups it is harmless if an
|
||||
* unpark call unparks a new thread using the old Parker reference.
|
||||
*
|
||||
* In the future we'll want to think about eliminating Parker and using
|
||||
* ParkEvent instead. There's considerable duplication between the two
|
||||
* services.
|
||||
*
|
||||
*/
|
||||
|
||||
class Parker : public os::PlatformParker {
|
||||
private:
|
||||
volatile int _counter ;
|
||||
Parker * FreeNext ;
|
||||
JavaThread * AssociatedWith ; // Current association
|
||||
|
||||
public:
|
||||
Parker() : PlatformParker() {
|
||||
_counter = 0 ;
|
||||
FreeNext = NULL ;
|
||||
AssociatedWith = NULL ;
|
||||
}
|
||||
protected:
|
||||
~Parker() { ShouldNotReachHere(); }
|
||||
public:
|
||||
// For simplicity of interface with Java, all forms of park (indefinite,
|
||||
// relative, and absolute) are multiplexed into one call.
|
||||
void park(bool isAbsolute, jlong time);
|
||||
void unpark();
|
||||
|
||||
// Lifecycle operators
|
||||
static Parker * Allocate (JavaThread * t) ;
|
||||
static void Release (Parker * e) ;
|
||||
private:
|
||||
static Parker * volatile FreeList ;
|
||||
static volatile int ListLock ;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue