Protecting critical sections in OpenJDK Hotspot with Mutex

The Mutex class is implementation for mutex lock in JVM. It derives from StackObj to inherit some common functionality.

To protect critical sections, the reference to Mutex has to be declared. The declaration is put in mutexLocker.hpp and it's attributed as extern

Than the reference has to be put mutexLocker.cpp to fill the missing symbol, reference should be set to NULL (for safety purposes, as some mutex can be conditionally initialised)

Mutex is initialised in mutex_init() method, using def() macro. Ie.

def(MemoryAttachList_lock, Mutex, leaf, true,  Monitor::_safepoint_check_sometimes);
SHARE
    Blogger Comment
    Facebook Comment

0 komentarze:

Post a Comment