1.1 --- a/src/os/bsd/vm/os_bsd.hpp Fri Feb 22 10:16:51 2013 -0800 1.2 +++ b/src/os/bsd/vm/os_bsd.hpp Wed Feb 27 09:40:30 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -151,36 +151,25 @@ 1.11 // for BsdThreads are no longer needed. 1.12 class SuspendResume { 1.13 private: 1.14 - volatile int _suspend_action; 1.15 + volatile int _suspend_action; 1.16 + volatile jint _state; 1.17 + public: 1.18 // values for suspend_action: 1.19 - #define SR_NONE (0x00) 1.20 - #define SR_SUSPEND (0x01) // suspend request 1.21 - #define SR_CONTINUE (0x02) // resume request 1.22 + enum { 1.23 + SR_NONE = 0x00, 1.24 + SR_SUSPEND = 0x01, // suspend request 1.25 + SR_CONTINUE = 0x02, // resume request 1.26 + SR_SUSPENDED = 0x20 // values for _state: + SR_NONE 1.27 + }; 1.28 1.29 - volatile jint _state; 1.30 - // values for _state: + SR_NONE 1.31 - #define SR_SUSPENDED (0x20) 1.32 - public: 1.33 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } 1.34 1.35 int suspend_action() const { return _suspend_action; } 1.36 void set_suspend_action(int x) { _suspend_action = x; } 1.37 1.38 // atomic updates for _state 1.39 - void set_suspended() { 1.40 - jint temp, temp2; 1.41 - do { 1.42 - temp = _state; 1.43 - temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); 1.44 - } while (temp2 != temp); 1.45 - } 1.46 - void clear_suspended() { 1.47 - jint temp, temp2; 1.48 - do { 1.49 - temp = _state; 1.50 - temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); 1.51 - } while (temp2 != temp); 1.52 - } 1.53 + inline void set_suspended(); 1.54 + inline void clear_suspended(); 1.55 bool is_suspended() { return _state & SR_SUSPENDED; } 1.56 1.57 #undef SR_SUSPENDED