2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afsconfig.h>
12 #include "afs/param.h"
16 #include "afs/sysincludes.h" /* Standard vendor system headers */
17 #include "afs/afsincludes.h" /* Afs-based standard headers */
18 #include "afs/afs_stats.h" /* afs statistics */
23 void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle)
25 AFS_STATCNT(osi_InitWaitHandle);
26 achandle->proc = NULL;
30 void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle)
34 AFS_STATCNT(osi_CancelWait);
35 proc = achandle->proc;
38 achandle->proc = NULL;
43 * Waits for data on ahandle, or ams ms later. ahandle may be null.
44 * Returns 0 if timeout and EINTR if signalled.
46 int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
50 int timo = (ams * afs_hz) / 1000 + 1;
52 AFS_STATCNT(osi_Wait);
53 endTime = osi_Time() + (ams / 1000);
55 ahandle->proc = (caddr_t) curproc;
58 code = tsleep(&waitV, PCATCH | (PZERO+8), "afs_osi_Wait", timo);
59 if (code) /* if interrupted, return EINTR */
62 tsleep(&waitV, (PZERO-3), "afs_osi_Wait", timo);
64 /* if we were cancelled, quit now */
65 if (ahandle && (ahandle->proc == NULL)) {
66 /* we've been signalled */
69 } while (osi_Time() < endTime);
73 void afs_osi_Sleep(void *event)
75 tsleep(event, PVFS, "afs", 0);
78 int afs_osi_SleepSig(void *event)
80 tsleep(event, PVFS, "afs", 0);
84 int afs_osi_Wakeup(void *event)