Browse Source

time: fix unix build

hikari 3 years ago
parent
commit
4f4793817c
1 changed files with 11 additions and 3 deletions
  1. 11 3
      core/time/time_unix.odin

+ 11 - 3
core/time/time_unix.odin

@@ -1,8 +1,6 @@
 //+build linux, darwin, freebsd, openbsd
 //+build linux, darwin, freebsd, openbsd
 package time
 package time
 
 
-import "core:sys/unix"
-
 IS_SUPPORTED :: true // NOTE: Times on Darwin are UTC.
 IS_SUPPORTED :: true // NOTE: Times on Darwin are UTC.
 
 
 when ODIN_OS == .Darwin {
 when ODIN_OS == .Darwin {
@@ -19,8 +17,18 @@ foreign libc {
 	@(link_name="nanosleep")     _unix_nanosleep     :: proc(requested: ^TimeSpec, remaining: ^TimeSpec) -> i32 ---
 	@(link_name="nanosleep")     _unix_nanosleep     :: proc(requested: ^TimeSpec, remaining: ^TimeSpec) -> i32 ---
 }
 }
 
 
+foreign import "system:pthread"
+
+import "core:c"
+
+@(private="file")
+@(default_calling_convention="c")
+foreign pthread {
+	sched_yield :: proc() -> c.int ---
+}
+
 _yield :: proc "contextless" () {
 _yield :: proc "contextless" () {
-	unix.sched_yield()
+	sched_yield()
 }
 }
 
 
 TimeSpec :: struct {
 TimeSpec :: struct {