ref: b332e98485d1c22cb93f3302b83ead9e004d5160
parent: 278b89b6962d2d81d280e4578a3481943a6ee79b
author: Ori Bernstein <ori@eigenstate.org>
date: Thu May 5 21:11:41 EDT 2016
Yield in sched()
--- a/lib/sys/sys+freebsd-x64.myr
+++ b/lib/sys/sys+freebsd-x64.myr
@@ -863,6 +863,7 @@
const clock_gettime : (clk : clock, ts : timespec# -> int32)
const clock_settime : (clk : clock, ts : timespec# -> int32)
const nanosleep : (req : timespec#, rem : timespec# -> int32)
+ const sched_yield : (-> void)
/* system information */
const uname : (buf : utsname# -> int)
@@ -991,6 +992,7 @@
const clock_gettime = {clk, ts; -> syscall(Sysclock_gettime, clockid(clk), a(ts)) castto(int32)}
const clock_settime = {clk, ts; -> syscall(Sysclock_settime, clockid(clk), a(ts)) castto(int32)}
const nanosleep = {req, rem; -> syscall(Sysnanosleep, a(req), a(rem)) castto(int32)}
+const sched_yield = {; syscall(Syssched_yield)}
/* system information */
--- a/lib/thread/bld.sub
+++ b/lib/thread/bld.sub
@@ -27,5 +27,8 @@
atomic-impl+x64.s
atomic.myr
+
+ lib ../sys:sys
+ lib ../std:std
;;
--- a/lib/thread/mutex+freebsd.myr
+++ b/lib/thread/mutex+freebsd.myr
@@ -37,6 +37,7 @@
if c == Unlocked
-> void
;;
+ sys.sched_yield()
;;
/*