Skip to content

Commit

Permalink
fix rlock compilation failure (#15584)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
shirleyquirk authored Oct 15, 2020
1 parent da4aa2e commit 4ef255b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/core/rlocks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/system/syslocks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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) {.
Expand Down

0 comments on commit 4ef255b

Please sign in to comment.