Use `when insideRLocksModule instead of when compiles`
This commit is contained in:
parent
ebc02f6dc0
commit
45bbecb021
3 changed files with 4 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
## This module contains Nim's support for locks and condition vars.
|
## This module contains Nim's support for locks and condition vars.
|
||||||
|
|
||||||
|
const insideRLocksModule = false
|
||||||
include "system/syslocks"
|
include "system/syslocks"
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -2884,6 +2884,7 @@ when not defined(JS): #and not defined(nimscript):
|
||||||
when declared(initAllocator):
|
when declared(initAllocator):
|
||||||
initAllocator()
|
initAllocator()
|
||||||
when hasThreadSupport:
|
when hasThreadSupport:
|
||||||
|
const insideRLocksModule = false
|
||||||
include "system/syslocks"
|
include "system/syslocks"
|
||||||
when hostOS != "standalone": include "system/threads"
|
when hostOS != "standalone": include "system/threads"
|
||||||
elif not defined(nogc) and not defined(nimscript):
|
elif not defined(nogc) and not defined(nimscript):
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ else:
|
||||||
proc initSysLock(L: var SysLock, attr: ptr SysLockAttr = nil) {.
|
proc initSysLock(L: var SysLock, attr: ptr SysLockAttr = nil) {.
|
||||||
importc: "pthread_mutex_init", header: "<pthread.h>", noSideEffect.}
|
importc: "pthread_mutex_init", header: "<pthread.h>", noSideEffect.}
|
||||||
|
|
||||||
when compiles(insideRLocksModule):
|
when insideRLocksModule:
|
||||||
proc SysLockType_Reentrant: SysLockType =
|
proc SysLockType_Reentrant: SysLockType =
|
||||||
{.emit: "`result` = PTHREAD_MUTEX_RECURSIVE;".}
|
{.emit: "`result` = PTHREAD_MUTEX_RECURSIVE;".}
|
||||||
proc initSysLockAttr(a: var SysLockAttr) {.
|
proc initSysLockAttr(a: var SysLockAttr) {.
|
||||||
|
|
@ -112,7 +112,7 @@ else:
|
||||||
proc deinitSys(L: var SysLock) {.noSideEffect,
|
proc deinitSys(L: var SysLock) {.noSideEffect,
|
||||||
importc: "pthread_mutex_destroy", header: "<pthread.h>".}
|
importc: "pthread_mutex_destroy", header: "<pthread.h>".}
|
||||||
|
|
||||||
when not compiles(insideRLocksModule):
|
when not insideRLocksModule:
|
||||||
proc initSysCond(cond: var SysCond, cond_attr: pointer = nil) {.
|
proc initSysCond(cond: var SysCond, cond_attr: pointer = nil) {.
|
||||||
importc: "pthread_cond_init", header: "<pthread.h>", noSideEffect.}
|
importc: "pthread_cond_init", header: "<pthread.h>", noSideEffect.}
|
||||||
proc waitSysCond(cond: var SysCond, lock: var SysLock) {.
|
proc waitSysCond(cond: var SysCond, lock: var SysLock) {.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue