8010151: nsk/regression/b6653214 fails "assert(snapshot != NULL) failed: Worker should not be started"

Fixed a racing condition when shutting down NMT while worker thread is being started, also fixed a few mis-declared volatile pointers.

Reviewed-by: dholmes, dlong
This commit is contained in:
Zhengyu Gu 2013-04-10 08:55:50 -04:00
parent be10521e31
commit 37fe1421a8
5 changed files with 27 additions and 26 deletions

View file

@ -421,7 +421,7 @@ class MemTracker : AllStatic {
private:
// start native memory tracking worker thread
static bool start_worker();
static bool start_worker(MemSnapshot* snapshot);
// called by worker thread to complete shutdown process
static void final_shutdown();
@ -475,18 +475,18 @@ class MemTracker : AllStatic {
// a thread can start to allocate memory before it is attached
// to VM 'Thread', those memory activities are recorded here.
// ThreadCritical is required to guard this global recorder.
static MemRecorder* _global_recorder;
static MemRecorder* volatile _global_recorder;
// main thread id
debug_only(static intx _main_thread_tid;)
// pending recorders to be merged
static volatile MemRecorder* _merge_pending_queue;
static MemRecorder* volatile _merge_pending_queue;
NOT_PRODUCT(static volatile jint _pending_recorder_count;)
// pooled memory recorders
static volatile MemRecorder* _pooled_recorders;
static MemRecorder* volatile _pooled_recorders;
// memory recorder pool management, uses following
// counter to determine if a released memory recorder