[OpenAFS-devel] Incorrect behavior in osi_TimedSleep and ppc_darwin_14

Nickolai Zeldovich kolya@MIT.EDU
Thu, 08 Nov 2001 09:57:27 -0500


>                                                       Is there anyone
> that can point me to a starting place on getting this problem solved?

Looking at the source code for xnu-9-1 (Darwin 1.4.1) from Apple, it
looks like AFS isn't setting TH_WAIT in osi_Sleep anywhere, whileas
it should call assert_wait() to put itself onto the wait queue.  Can
you try something like this patch?  (Unfortunately I don't have access
to a MacOS X machine, so I couldn't really test this..)

-- kolya

--- afs/DARWIN/osi_sleep.c	2001/07/12 19:58:19	1.3
+++ afs/DARWIN/osi_sleep.c	2001/11/08 14:57:01
@@ -152,16 +152,13 @@
 {
     int code = 0;
     struct afs_event *evp;
-    int ticks,seq;
+    int seq;
 
-    ticks = ( ams * afs_hz )/1000;
-
-
     evp = afs_getevent(event);
     seq=evp->seq;
     assert_wait((event_t)event, aintok ? THREAD_ABORTSAFE : 0);
     AFS_GUNLOCK();
-    thread_set_timer(ticks, NSEC_PER_SEC / hz);
+    assert_wait_timeout(ams, THREAD_UNINT);
     thread_block(0);
     AFS_GLOCK();
 #if 0 /* thread_t structure only available if MACH_KERNEL_PRIVATE */