[Ecls-list] Make CL:SLEEP enter alertable wait state on win32

Samium Gromoff _deepfire at feelingofgreen.ru
Tue Aug 12 22:53:22 UTC 2008


Good day folks,

The patch below makes the CL:SLEEP's wait "alertable", using the
win32-speak.

One of the intended effects is that other threads might call
QueueUserAPC()+raise() to simulate pthread_kill() -- with the time window
being the period spent in that "alertable wait state".

A proper patch, I guess, would differ in two aspects -- first, it would
change other functions using non-alertable win32 calls to their alertable
analogs (if there are any), and second, probably more importantly,
it would ensure that CL:SLEEP would sleep no less than asked, which,
in the current incarnation, isn't guaranteed.

regards, Samium Gromoff


diff --git a/src/c/time.d b/src/c/time.d
--- a/src/c/time.d
+++ b/src/c/time.d
@@ -142,7 +142,7 @@ cl_sleep(cl_object z)
 #else
 #if defined (mingw32) || defined(_MSC_VER)
 	r = ecl_to_double(z) * 1000;
-	Sleep((long)r);
+	SleepEx((long)r, TRUE);
 #else
 	z = ecl_round1(z);
 	if (FIXNUMP(z))




More information about the ecl-devel mailing list