long oldstatus;
long oldstatus = 0;
int __pthread_alt_timedlock(struct _pthread_fastlock * lock,			    pthread_descr self, const struct timespec *abstime){  long oldstatus;#if defined HAS_COMPARE_AND_SWAP  long newstatus;#endif  struct wait_node *p_wait_node = wait_node_alloc();  /* Out of memory, just give up and do ordinary lock. */  if (p_wait_node == 0) {    __pthread_alt_lock(lock, self);    return 1;  }#if defined TEST_FOR_COMPARE_AND_SWAP  if (!__pthread_has_cas)#endif#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP  {    __pthread_acquire(&lock->__spinlock);    if (lock->__status == 0)      lock->__status = 1;    else {      if (self == NULL)	self = thread_self();      p_wait_node->abandoned = 0;      p_wait_node->next = (struct wait_node *) lock->__status;      p_wait_node->thr = self;    }    WRITE_MEMORY_BARRIER();    lock->__spinlock = 0;    oldstatus = 1; /* force suspend */    goto suspend;  }#endif#if defined HAS_COMPARE_AND_SWAP  do {    oldstatus = lock->__status;    if (oldstatus == 0) {      newstatus = 1;    } else {      if (self == NULL)	self = thread_self();      p_wait_node->thr = self;      newstatus = (long) p_wait_node;    }    p_wait_node->abandoned = 0;    p_wait_node->next = (struct wait_node *) oldstatus;    /* Make sure the store in wait_node.next completes before performing       the compare-and-swap */    MEMORY_BARRIER();  } while(! __compare_and_swap(&lock->__status, oldstatus, newstatus));#endif#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP  suspend:#endif  /* If we did not get the lock, do a timed suspend. If we wake up due     to a timeout, then there is a race; the old lock owner may try     to remove us from the queue. This race is resolved by us and the owner     doing an atomic testandset() to change the state of the wait node from 0     to 1. If we succeed, then it's a timeout and we abandon the node in the     queue. If we fail, it means the owner gave us the lock. */  if (oldstatus != 0) {    if (timedsuspend(self, abstime) == 0) {      if (!testandset(&p_wait_node->abandoned))	return 0; /* Timeout! */      /* Eat oustanding resume from owner, otherwise wait_node_free() below	 will race with owner's wait_node_dequeue(). */      suspend(self);    }  }  wait_node_free(p_wait_node);  return 1; /* Got the lock! */}