#ifndef WAPI_ATOMIC_ASM
#warning "Atomic functions are not atomic!"
-static pthread_spinlock_t spin;
+static pthread_mutex_t spin;
static pthread_once_t spin_once=PTHREAD_ONCE_INIT;
static void spin_init(void)
{
- pthread_spin_init(&spin, 0);
+ pthread_mutex_init(&spin, 0);
g_warning("Using non-atomic functions!");
}
gint32 old;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
old= *dest;
if(old==comp) {
*dest=exch;
}
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(old);
}
gpointer old;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
old= *dest;
if(old==comp) {
*dest=exch;
}
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(old);
}
gint32 ret;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
*dest++;
ret= *dest;
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(ret);
}
gint32 ret;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
*dest--;
ret= *dest;
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(ret);
}
gint32 ret;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
ret=*dest;
*dest=exch;
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(ret);
}
gpointer ret;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
ret=*dest;
*dest=exch;
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(ret);
}
gint32 ret;
pthread_once(&spin_once, spin_init);
- pthread_spin_lock(&spin);
+ pthread_mutex_lock(&spin);
ret= *dest;
*dest+=add;
- pthread_spin_unlock(&spin);
+ pthread_mutex_unlock(&spin);
return(ret);
}