You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by wj...@apache.org on 2006/10/31 02:39:02 UTC
svn commit: r469335 -
/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
Author: wjwashburn
Date: Mon Oct 30 17:39:02 2006
New Revision: 469335
URL: http://svn.apache.org/viewvc?view=rev&rev=469335
Log:
HARMONY-1929, [drlvm][threading] 16-bit atomic op is used on a 32-bit value
build and "build test" runs on windowsxp and linux w/ gcc 4.0.2
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c?view=diff&rev=469335&r1=469334&r2=469335
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c Mon Oct 30 17:39:02 2006
@@ -32,11 +32,8 @@
#include <open/thread_externals.h>
#include "thread_private.h"
#include <apr_atomic.h>
-#include <port_atomic.h>
-static void thread_safe_point_impl(hythread_t thread);
-int16 atomic16_inc(int16 *value);
-int16 atomic16_dec(int16 *value);
+static void thread_safe_point_impl(hythread_t thread);
/** @name Safe suspension support
*/
@@ -199,15 +196,15 @@
assert(thread->suspend_request >=0);
// already suspended?
if(thread->suspend_request > 0) {
- atomic16_inc((int16 *)&(thread->suspend_request));
- return;
+ apr_atomic_inc32((apr_uint32_t *)&(thread->suspend_request));
+ return;
}
//we realy need to suspend thread.
hysem_set(thread->resume_event, 0);
- atomic16_inc((int16 *)&(thread->suspend_request));
+ apr_atomic_inc32((apr_uint32_t *)&(thread->suspend_request));
apr_thread_yield_other(thread->os_handle);
@@ -248,7 +245,7 @@
void VMCALL hythread_suspend() {
hythread_t thread = tm_self_tls;
- atomic16_inc((int16 *)&(thread->suspend_request));
+ apr_atomic_inc32((apr_uint32_t *)&(thread->suspend_request));
hythread_safe_point();
}
@@ -319,7 +316,7 @@
// printf("resume other now lock %d %d %d %d\n",tm_self_tls->thread_id,tm_self_tls->suspend_disable_count,thread->thread_id,thread->suspend_disable_count);
if(thread->suspend_request > 0) {
if (thread->safepoint_callback && thread->suspend_request < 2) return;
- atomic16_dec((int16 *)&(thread->suspend_request));
+ apr_atomic_dec32((apr_uint32_t *)&(thread->suspend_request));
if(thread->suspend_request == 0) {
// Notify the thread that it may wake up now
hysem_post(thread->resume_event);
@@ -475,25 +472,5 @@
thread_safe_point_impl(self);
}
}
-int16 atomic16_inc(int16 *value)
-{
- int16 old_value=*value;
- while(port_atomic_cas16((volatile apr_uint16_t*)value,(apr_uint16_t)(old_value+1),(apr_uint16_t)old_value)!=old_value)
- {
- old_value=*value;
- }
-
- return old_value+1;
-}
-int16 atomic16_dec(int16 *value)
-{
- int16 old_value=*value;
- while(port_atomic_cas16((volatile apr_uint16_t*)value,(apr_uint16_t)(old_value-1),(apr_uint16_t)old_value)!=old_value)
- {
- old_value=*value;
- }
- return old_value-1;
-}
-
//@}