< prev index next >

src/share/vm/runtime/thread.inline.hpp

Print this page


   1 /*
   2  * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP
  26 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP
  27 
  28 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
  29 
  30 #include "runtime/atomic.inline.hpp"
  31 #include "runtime/os.inline.hpp"
  32 #include "runtime/thread.hpp"
  33 #ifdef TARGET_OS_FAMILY_linux
  34 # include "thread_linux.inline.hpp"
  35 #endif
  36 #ifdef TARGET_OS_FAMILY_solaris
  37 # include "thread_solaris.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_windows
  40 # include "thread_windows.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_aix
  43 # include "thread_aix.inline.hpp"
  44 #endif
  45 #ifdef TARGET_OS_FAMILY_bsd
  46 # include "thread_bsd.inline.hpp"
  47 #endif
  48 
  49 #undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
  50 
  51 inline void Thread::set_suspend_flag(SuspendFlags f) {
  52   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
  53   uint32_t flags;
  54   do {
  55     flags = _suspend_flags;
  56   }
  57   while (Atomic::cmpxchg((jint)(flags | f),
  58                          (volatile jint*)&_suspend_flags,
  59                          (jint)flags) != (jint)flags);
  60 }
  61 inline void Thread::clear_suspend_flag(SuspendFlags f) {
  62   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
  63   uint32_t flags;
  64   do {
  65     flags = _suspend_flags;
  66   }
  67   while (Atomic::cmpxchg((jint)(flags & ~f),


   1 /*
   2  * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP
  26 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP
  27 
  28 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
  29 
  30 #include "runtime/atomic.inline.hpp"
  31 #include "runtime/os.inline.hpp"
  32 #include "runtime/thread.hpp"















  33 
  34 #undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
  35 
  36 inline void Thread::set_suspend_flag(SuspendFlags f) {
  37   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
  38   uint32_t flags;
  39   do {
  40     flags = _suspend_flags;
  41   }
  42   while (Atomic::cmpxchg((jint)(flags | f),
  43                          (volatile jint*)&_suspend_flags,
  44                          (jint)flags) != (jint)flags);
  45 }
  46 inline void Thread::clear_suspend_flag(SuspendFlags f) {
  47   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
  48   uint32_t flags;
  49   do {
  50     flags = _suspend_flags;
  51   }
  52   while (Atomic::cmpxchg((jint)(flags & ~f),


< prev index next >