Path: blob/master/runtime/compiler/infra/RWMonitor.cpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2016 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#include "infra/RWMonitor.hpp"23#include "j9cfg.h"24#include "j9thread.h"25#include "j9port.h"2627#ifdef J9VM_JIT_CLASS_UNLOAD_RWMONITOR28void29J9::RWMonitor::enter_read()30{31j9thread_rwmutex_enter_read(_monitor);32}333435void36J9::RWMonitor::enter_write()37{38j9thread_rwmutex_enter_write(_monitor);39}404142void43J9::RWMonitor::exit_read()44{45j9thread_rwmutex_exit_read(_monitor);46}474849void50J9::RWMonitor::exit_write()51{52j9thread_rwmutex_exit_write(_monitor);53}545556void57J9::RWMonitor::destroy()58{59j9thread_rwmutex_destroy(_monitor);60}616263bool64J9::RWMonitor::init(char *name)65{66return j9thread_rwmutex_init(&_monitor, 0, name) == 0 ? true : false;67}686970bool71J9::RWMonitor::initFromVMMutex(void *mutex)72{73_monitor = (RWMutex*)mutex;74return true;75}7677#else7879void80J9::RWMonitor::enter_read()81{82j9thread_monitor_enter(_monitor);83}848586void87J9::RWMonitor::enter_write()88{89j9thread_monitor_enter(_monitor);90}919293void94J9::RWMonitor::exit_read()95{96j9thread_monitor_exit(_monitor);97}9899100void101J9::RWMonitor::exit_write()102{103j9thread_monitor_exit(_monitor);104}105106107void108J9::RWMonitor::destroy()109{110j9thread_monitor_destroy(_monitor);111}112113114bool115J9::RWMonitor::init(char *name)116{117return j9thread_monitor_init_with_name((J9ThreadMonitor**)&_monitor, 0, name) == 0 ? true : false;118}119120121bool122J9::RWMonitor::initFromVMMutex(void *mutex)123{124_monitor = (J9ThreadMonitor*)mutex; return true;125}126127#endif128129130