mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Cleanup
This commit is contained in:
parent
5cb5540d2e
commit
a14d3efe80
1 changed files with 4 additions and 8 deletions
12
srfi/18.sld
12
srfi/18.sld
|
@ -212,7 +212,6 @@
|
|||
}
|
||||
return_thread_runnable(data, boolean_t); ")
|
||||
|
||||
;; TODO: WIP, this is broken right now!
|
||||
(define-c %mutex-timedlock!
|
||||
"(void *data, int argc, closure _, object k, object obj, object timeout)"
|
||||
" mutex m = (mutex) obj;
|
||||
|
@ -221,17 +220,14 @@
|
|||
Cyc_check_mutex(data, obj);
|
||||
Cyc_check_num(data, timeout);
|
||||
value = unbox_number(timeout);
|
||||
printf(\"tv_sec = %ld\\n\", tim.tv_sec);
|
||||
printf(\"tv_nsec = %ld\\n\", tim.tv_nsec);
|
||||
set_thread_blocked(data, k);
|
||||
// clock_gettime(CLOCK_REALTIME, &tim);
|
||||
// clock_gettime(CLOCK_MONOTONIC, &tim);
|
||||
gettimeofday(&tim, NULL);
|
||||
clock_gettime(CLOCK_REALTIME, &tim);
|
||||
//clock_gettime(CLOCK_MONOTONIC, &tim);
|
||||
//gettimeofday(&tim, NULL);
|
||||
tim.tv_sec += (long)value;
|
||||
tim.tv_nsec += (long)((value - tim.tv_sec) * 1000 * NANOSECONDS_PER_MILLISECOND);
|
||||
tim.tv_nsec += (long)((value - ((long)value)) * 1000 * NANOSECONDS_PER_MILLISECOND);
|
||||
int result = pthread_mutex_timedlock(&(m->lock), &tim);
|
||||
if (result != 0) {
|
||||
printf(\"result = %d\\n\", result);
|
||||
return_thread_runnable(data, boolean_f);
|
||||
}
|
||||
return_thread_runnable(data, boolean_t); ")
|
||||
|
|
Loading…
Add table
Reference in a new issue