diff options
author | shirleyquirk <31934565+shirleyquirk@users.noreply.github.com> | 2020-10-15 11:54:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 12:54:01 +0200 |
commit | 4ef255b69d00d66e4554bad72fab1780578792f5 (patch) | |
tree | 6b6ed0ece7238e9e8bfe71fc9e619522fdbd7669 | |
parent | da4aa2e1fb8b0084fcf03b85edf4a5c1d0170856 (diff) | |
download | Nim-4ef255b69d00d66e4554bad72fab1780578792f5.tar.gz |
fix rlock compilation failure (#15584)
* change SysLockType_Reentrant fix edge case where using SysLockType_Reentrant doesn't trigger an #include pthread.h * syslocktype_reentrant now a var * remove nodecl to remove empty system_syslocks.c * let is better than var. in reality SysLockType = enum, maybe that would be a better fix
-rw-r--r-- | lib/core/rlocks.nim | 2 | ||||
-rw-r--r-- | lib/system/syslocks.nim | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/core/rlocks.nim b/lib/core/rlocks.nim index 34d7687f9..27a9c5e60 100644 --- a/lib/core/rlocks.nim +++ b/lib/core/rlocks.nim @@ -24,7 +24,7 @@ proc initRLock*(lock: var RLock) {.inline.} = when defined(posix): var a: SysLockAttr initSysLockAttr(a) - setSysLockType(a, SysLockType_Reentrant()) + setSysLockType(a, SysLockType_Reentrant) initSysLock(lock, a.addr) else: initSysLock(lock) diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim index b7f7aa6bf..07fb9cb8a 100644 --- a/lib/system/syslocks.nim +++ b/lib/system/syslocks.nim @@ -181,8 +181,8 @@ else: releaseSysAux(L) when insideRLocksModule: - proc SysLockType_Reentrant: SysLockType = - {.emit: "`result` = PTHREAD_MUTEX_RECURSIVE;".} + let SysLockType_Reentrant{.importc: "PTHREAD_MUTEX_RECURSIVE", + header: "<pthread.h>".}: SysLockType proc initSysLockAttr(a: var SysLockAttr) {. importc: "pthread_mutexattr_init", header: "<pthread.h>", noSideEffect.} proc setSysLockType(a: var SysLockAttr, t: SysLockType) {. |