diff --git a/src/c/main.d b/src/c/main.d index 2774d4485..fbaae6674 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -806,7 +806,7 @@ cl_boot(int argc, char **argv) * When the thread exits, sometimes the dyld library gets * called, and if we call dlopen() at the same time we * cause ECL to hang */ - ecl_musleep(1e-3, 1); + ecl_musleep(1e-3); } #endif ECL_SET(@'ext::*program-exit-code*', code); diff --git a/src/c/threads/process.d b/src/c/threads/process.d index 097307c87..b9bd18b00 100755 --- a/src/c/threads/process.d +++ b/src/c/threads/process.d @@ -526,7 +526,7 @@ mp_process_yield(void) #elif defined(HAVE_SCHED_H) sched_yield(); #else - ecl_musleep(0.0, 1); + ecl_musleep(0.0); #endif @(return); } diff --git a/src/c/time.d b/src/c/time.d index 6b4e19676..166a2a7c3 100644 --- a/src/c/time.d +++ b/src/c/time.d @@ -107,7 +107,7 @@ ecl_get_internal_run_time(struct ecl_timeval *tv) } void -ecl_musleep(double time, bool alertable) +ecl_musleep(double time) { #ifdef HAVE_NANOSLEEP struct timespec tm; @@ -118,7 +118,7 @@ ecl_musleep(double time, bool alertable) code = nanosleep(&tm, &tm); { int old_errno = errno; - if (code < 0 && old_errno == EINTR && !alertable) { + if (code < 0 && old_errno == EINTR) { goto AGAIN; } } @@ -133,10 +133,8 @@ ecl_musleep(double time, bool alertable) FILETIME filetime; DWORDLONG hundred_ns; } end, now; - if (alertable) { - GetSystemTimeAsFileTime(&end.filetime); - end.hundred_ns += wait; - } + GetSystemTimeAsFileTime(&end.filetime); + end.hundred_ns += wait; do { DWORDLONG interval; if (wait > maxtime) { @@ -146,16 +144,12 @@ ecl_musleep(double time, bool alertable) interval = wait; wait = 0; } - if (SleepEx(interval/10000, alertable) != 0) { - if (alertable) { + if (SleepEx(interval/10000, 1) != 0) { + GetSystemTimeAsFileTime(&now.filetime); + if (now.hundred_ns >= end.hundred_ns) break; - } else { - GetSystemTimeAsFileTime(&now.filetime); - if (now.hundred_ns >= end.hundred_ns) - break; - else - wait = end.hundred_ns - now.hundred_ns; - } + else + wait = end.hundred_ns - now.hundred_ns; } } while (wait); #else @@ -194,7 +188,7 @@ cl_sleep(cl_object z) time = 1e-9; } } ECL_WITHOUT_FPE_END; - ecl_musleep(time, 1); + ecl_musleep(time); @(return ECL_NIL); } diff --git a/src/h/internal.h b/src/h/internal.h index 701d8697f..d08fce085 100755 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -419,7 +419,7 @@ struct ecl_timeval { extern void ecl_get_internal_real_time(struct ecl_timeval *time); extern void ecl_get_internal_run_time(struct ecl_timeval *time); -extern void ecl_musleep(double time, bool alertable); +extern void ecl_musleep(double time); #define UTC_time_to_universal_time(x) ecl_plus(ecl_make_integer(x),cl_core.Jan1st1970UT) extern cl_fixnum ecl_runtime(void);