Index: trunk/vm/thread/src/thread_native_suspend.c =================================================================== --- trunk/vm/thread/src/thread_native_suspend.c (revision 466035) +++ trunk/vm/thread/src/thread_native_suspend.c (working copy) @@ -32,12 +32,9 @@ #include #include "thread_private.h" #include -#include + static void thread_safe_point_impl(hythread_t thread); -int16 atomic16_inc(int16 *value); -int16 atomic16_dec(int16 *value); - /** @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; -} - - //@}