+ again:
+ if (sec<0) {
+ t = sys_futex(lock_word,FUTEX_WAIT,oldval, 0);
+ }
+ else {
+ timeout.tv_sec = sec;
+ timeout.tv_nsec = usec * 1000;
+ t = sys_futex(lock_word,FUTEX_WAIT,oldval, &timeout);
+ }
+ if (t==0)
+ return 0;
+ else if (errno==ETIMEDOUT)
+ return 1;
+ else if (errno==EINTR)
+ /* spurious wakeup from interrupt */
+ goto again;
+ else
+ /* EWOULDBLOCK and others, need to check the lock */
+ return -1;