{
pthread_t self = pthread_self();
- return (_objc_thread_t) self; /* Return thread handle. */
+ return (_objc_thread_t) pthread_getuniqe_np (&self);
}
/********
free(mutex); /* Yes, free local memory. */
return NULL; /* Abort. */
}
- mutex->owner = -1; /* No owner. */
+ mutex->owner = (_objc_thread_t) -1; /* No owner. */
mutex->depth = 0; /* No locks. */
return mutex; /* Return mutex handle. */
}
int
objc_mutex_lock(_objc_mutex_t mutex)
{
- int thread_id; /* Cache our thread id. */
+ _objc_thread_t thread_id; /* Cache our thread id. */
if (!mutex) /* Is argument bad? */
return -1; /* Yes, abort. */
int
objc_mutex_trylock(_objc_mutex_t mutex)
{
- int thread_id; /* Cache our thread id. */
+ _objc_thread_t thread_id; /* Cache our thread id. */
if (!mutex) /* Is argument bad? */
return -1; /* Yes, abort. */
int
objc_mutex_unlock(_objc_mutex_t mutex)
{
- int thread_id; /* Cache our thread id. */
+ _objc_thread_t thread_id; /* Cache our thread id. */
if (!mutex) /* Is argument bad? */
return -1; /* Yes, abort. */
if (mutex->depth > 1) /* Released last lock? */
return --mutex->depth; /* No, Decrement depth, end.*/
mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = -1; /* Set owner to "no thread".*/
+ mutex->owner = (_objc_thread_t) -1; /* Set owner to "no thread".*/
if (pthread_mutex_unlock(&mutex->lock) != 0) /* Unlock system mutex. */
return -1; /* Failed, abort. */