fixes #4088
This commit is contained in:
parent
ea76b2320b
commit
479373ad79
3 changed files with 9 additions and 9 deletions
|
|
@ -751,7 +751,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
noVal(it)
|
noVal(it)
|
||||||
incl(sym.flags, sfThread)
|
incl(sym.flags, sfThread)
|
||||||
incl(sym.flags, sfProcvar)
|
incl(sym.flags, sfProcvar)
|
||||||
if sym.typ != nil: incl(sym.typ.flags, tfThread)
|
if sym.typ != nil:
|
||||||
|
incl(sym.typ.flags, tfThread)
|
||||||
|
if sym.typ.callConv == ccClosure: sym.typ.callConv = ccDefault
|
||||||
of wGcSafe:
|
of wGcSafe:
|
||||||
noVal(it)
|
noVal(it)
|
||||||
if sym.kind != skType: incl(sym.flags, sfThread)
|
if sym.kind != skType: incl(sym.flags, sfThread)
|
||||||
|
|
|
||||||
|
|
@ -1141,14 +1141,12 @@ proc semProcTypeWithScope(c: PContext, n: PNode,
|
||||||
checkSonsLen(n, 2)
|
checkSonsLen(n, 2)
|
||||||
openScope(c)
|
openScope(c)
|
||||||
result = semProcTypeNode(c, n.sons[0], nil, prev, kind, isType=true)
|
result = semProcTypeNode(c, n.sons[0], nil, prev, kind, isType=true)
|
||||||
|
# start with 'ccClosure', but of course pragmas can overwrite this:
|
||||||
|
result.callConv = ccClosure
|
||||||
# dummy symbol for `pragma`:
|
# dummy symbol for `pragma`:
|
||||||
var s = newSymS(kind, newIdentNode(getIdent("dummy"), n.info), c)
|
var s = newSymS(kind, newIdentNode(getIdent("dummy"), n.info), c)
|
||||||
s.typ = result
|
s.typ = result
|
||||||
if n.sons[1].kind == nkEmpty or n.sons[1].len == 0:
|
if n.sons[1].kind != nkEmpty and n.sons[1].len > 0:
|
||||||
if result.callConv == ccDefault:
|
|
||||||
result.callConv = ccClosure
|
|
||||||
#Message(n.info, warnImplicitClosure, renderTree(n))
|
|
||||||
else:
|
|
||||||
pragma(c, s, n.sons[1], procTypePragmas)
|
pragma(c, s, n.sons[1], procTypePragmas)
|
||||||
when useEffectSystem: setEffectsForProcType(result, n.sons[1])
|
when useEffectSystem: setEffectsForProcType(result, n.sons[1])
|
||||||
closeScope(c)
|
closeScope(c)
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ when false:
|
||||||
|
|
||||||
when hostOS == "windows":
|
when hostOS == "windows":
|
||||||
proc createThread*[TArg](t: var Thread[TArg],
|
proc createThread*[TArg](t: var Thread[TArg],
|
||||||
tp: proc (arg: TArg) {.thread.},
|
tp: proc (arg: TArg) {.thread, nimcall.},
|
||||||
param: TArg) =
|
param: TArg) =
|
||||||
## creates a new thread `t` and starts its execution. Entry point is the
|
## creates a new thread `t` and starts its execution. Entry point is the
|
||||||
## proc `tp`. `param` is passed to `tp`. `TArg` can be ``void`` if you
|
## proc `tp`. `param` is passed to `tp`. `TArg` can be ``void`` if you
|
||||||
|
|
@ -441,7 +441,7 @@ when hostOS == "windows":
|
||||||
|
|
||||||
else:
|
else:
|
||||||
proc createThread*[TArg](t: var Thread[TArg],
|
proc createThread*[TArg](t: var Thread[TArg],
|
||||||
tp: proc (arg: TArg) {.thread.},
|
tp: proc (arg: TArg) {.thread, nimcall.},
|
||||||
param: TArg) =
|
param: TArg) =
|
||||||
## creates a new thread `t` and starts its execution. Entry point is the
|
## creates a new thread `t` and starts its execution. Entry point is the
|
||||||
## proc `tp`. `param` is passed to `tp`. `TArg` can be ``void`` if you
|
## proc `tp`. `param` is passed to `tp`. `TArg` can be ``void`` if you
|
||||||
|
|
@ -464,7 +464,7 @@ else:
|
||||||
cpusetIncl(cpu.cint, s)
|
cpusetIncl(cpu.cint, s)
|
||||||
setAffinity(t.sys, sizeof(s), s)
|
setAffinity(t.sys, sizeof(s), s)
|
||||||
|
|
||||||
proc createThread*(t: var Thread[void], tp: proc () {.thread.}) =
|
proc createThread*(t: var Thread[void], tp: proc () {.thread, nimcall.}) =
|
||||||
createThread[void](t, tp)
|
createThread[void](t, tp)
|
||||||
|
|
||||||
proc threadId*[TArg](t: var Thread[TArg]): ThreadId[TArg] {.inline.} =
|
proc threadId*[TArg](t: var Thread[TArg]): ThreadId[TArg] {.inline.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue