Mercurial > hg > truffle
comparison src/os/solaris/vm/osThread_solaris.cpp @ 274:f7e6d42d9323
6618886: Anonymous objects can be destructed immediately and so should not be used
Reviewed-by: dholmes, kamg
author | xlu |
---|---|
date | Fri, 01 Aug 2008 15:18:14 -0700 |
parents | a61af66fc99e |
children | 9ee9cf798b59 |
comparison
equal
deleted
inserted
replaced
273:6f17a7c9f8b4 | 274:f7e6d42d9323 |
---|---|
67 | 67 |
68 // used after a thread is suspended | 68 // used after a thread is suspended |
69 static intptr_t compare_and_exchange_current_callback ( | 69 static intptr_t compare_and_exchange_current_callback ( |
70 intptr_t callback, intptr_t *addr, intptr_t compare_value, Mutex *sync) { | 70 intptr_t callback, intptr_t *addr, intptr_t compare_value, Mutex *sync) { |
71 if (VM_Version::supports_compare_and_exchange()) { | 71 if (VM_Version::supports_compare_and_exchange()) { |
72 return Atomic::cmpxchg_ptr(callback, addr, compare_value); | 72 return Atomic::cmpxchg_ptr(callback, addr, compare_value); |
73 } else { | 73 } else { |
74 MutexLockerEx(sync, Mutex::_no_safepoint_check_flag); | 74 MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag); |
75 if (*addr == compare_value) { | 75 if (*addr == compare_value) { |
76 *addr = callback; | 76 *addr = callback; |
77 return compare_value; | 77 return compare_value; |
78 } else { | 78 } else { |
79 return callback; | 79 return callback; |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 // used in signal handler | 84 // used in signal handler |
85 static intptr_t exchange_current_callback(intptr_t callback, intptr_t *addr, Mutex *sync) { | 85 static intptr_t exchange_current_callback(intptr_t callback, intptr_t *addr, Mutex *sync) { |
86 if (VM_Version::supports_compare_and_exchange()) { | 86 if (VM_Version::supports_compare_and_exchange()) { |
87 return Atomic::xchg_ptr(callback, addr); | 87 return Atomic::xchg_ptr(callback, addr); |
88 } else { | 88 } else { |
89 MutexLockerEx(sync, Mutex::_no_safepoint_check_flag); | 89 MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag); |
90 intptr_t cb = *addr; | 90 intptr_t cb = *addr; |
91 *addr = callback; | 91 *addr = callback; |
92 return cb; | 92 return cb; |
93 } | 93 } |
94 } | 94 } |