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
This commit is contained in:
parent
da4aa2e1fb
commit
4ef255b69d
2 changed files with 3 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ proc initRLock*(lock: var RLock) {.inline.} =
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
var a: SysLockAttr
|
var a: SysLockAttr
|
||||||
initSysLockAttr(a)
|
initSysLockAttr(a)
|
||||||
setSysLockType(a, SysLockType_Reentrant())
|
setSysLockType(a, SysLockType_Reentrant)
|
||||||
initSysLock(lock, a.addr)
|
initSysLock(lock, a.addr)
|
||||||
else:
|
else:
|
||||||
initSysLock(lock)
|
initSysLock(lock)
|
||||||
|
|
|
||||||
|
|
@ -181,8 +181,8 @@ else:
|
||||||
releaseSysAux(L)
|
releaseSysAux(L)
|
||||||
|
|
||||||
when insideRLocksModule:
|
when insideRLocksModule:
|
||||||
proc SysLockType_Reentrant: SysLockType =
|
let SysLockType_Reentrant{.importc: "PTHREAD_MUTEX_RECURSIVE",
|
||||||
{.emit: "`result` = PTHREAD_MUTEX_RECURSIVE;".}
|
header: "<pthread.h>".}: SysLockType
|
||||||
proc initSysLockAttr(a: var SysLockAttr) {.
|
proc initSysLockAttr(a: var SysLockAttr) {.
|
||||||
importc: "pthread_mutexattr_init", header: "<pthread.h>", noSideEffect.}
|
importc: "pthread_mutexattr_init", header: "<pthread.h>", noSideEffect.}
|
||||||
proc setSysLockType(a: var SysLockAttr, t: SysLockType) {.
|
proc setSysLockType(a: var SysLockAttr, t: SysLockType) {.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue