summary refs log tree commit diff stats
path: root/lib/system/syslocks.nim
diff options
context:
space:
mode:
authorEmery Hemingway <githubjunk@spam.works>2017-03-31 16:13:06 -0500
committerAndreas Rumpf <rumpf_a@web.de>2017-03-31 23:13:06 +0200
commit7e351fc7fa96b4d560c5a51118bab22abb590585 (patch)
treee0f5dd4deb394e86d95244317b0a328bb970842d /lib/system/syslocks.nim
parent57246cbcec2f747d5af33ebf4c8c0e0a531eba02 (diff)
downloadNim-7e351fc7fa96b4d560c5a51118bab22abb590585.tar.gz
support for the Genode OS framework (#5560)
Diffstat (limited to 'lib/system/syslocks.nim')
-rw-r--r--lib/system/syslocks.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim
index c3e23052b..9d056611f 100644
--- a/lib/system/syslocks.nim
+++ b/lib/system/syslocks.nim
@@ -75,6 +75,28 @@ when defined(Windows):
   proc waitSysCondWindows(cond: var SysCond) =
     discard waitForSingleObject(cond, -1'i32)
 
+elif defined(genode):
+  const
+    Header = "genode_cpp/syslocks.h"
+  type
+    SysLock {.importcpp: "Nim::SysLock", pure, final,
+              header: Header.} = object
+    SysCond {.importcpp: "Nim::SysCond", pure, final,
+              header: Header.} = object
+
+  proc initSysLock(L: var SysLock) = discard
+  proc deinitSys(L: var SysLock) = discard
+  proc acquireSys(L: var SysLock) {.noSideEffect, importcpp.}
+  proc tryAcquireSys(L: var SysLock): bool {.noSideEffect, importcpp.}
+  proc releaseSys(L: var SysLock) {.noSideEffect, importcpp.}
+
+  proc initSysCond(L: var SysCond) = discard
+  proc deinitSysCond(L: var SysCond) = discard
+  proc waitSysCond(cond: var SysCond, lock: var SysLock) {.
+    noSideEffect, importcpp.}
+  proc signalSysCond(cond: var SysCond) {.
+    noSideEffect, importcpp.}
+
 else:
   type
     SysLock {.importc: "pthread_mutex_t", pure, final,