fix failed tests due to gcsafe
This commit is contained in:
parent
d1300de5e6
commit
4d863ebb5e
7 changed files with 55 additions and 50 deletions
|
|
@ -588,6 +588,7 @@ proc register*(d: PDispatcher, ftp: PAsyncFTPClient): PDelegate {.discardable.}
|
||||||
return ftp.disp.register(ftp.asyncCSock)
|
return ftp.disp.register(ftp.asyncCSock)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
|
proc main =
|
||||||
var d = newDispatcher()
|
var d = newDispatcher()
|
||||||
let hev =
|
let hev =
|
||||||
proc (ftp: PAsyncFTPClient, event: TFTPEvent) =
|
proc (ftp: PAsyncFTPClient, event: TFTPEvent) =
|
||||||
|
|
@ -620,7 +621,7 @@ when isMainModule:
|
||||||
echo "uploading..."
|
echo "uploading..."
|
||||||
while true:
|
while true:
|
||||||
if not d.poll(): break
|
if not d.poll(): break
|
||||||
|
main()
|
||||||
|
|
||||||
when isMainModule and false:
|
when isMainModule and false:
|
||||||
var ftp = ftpClient("picheta.me", user = "asdasd", pass = "asfwq")
|
var ftp = ftpClient("picheta.me", user = "asdasd", pass = "asfwq")
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ proc newRope(data: string): PRope =
|
||||||
result.data = data
|
result.data = data
|
||||||
|
|
||||||
var
|
var
|
||||||
cache: PRope # the root of the cache tree
|
cache {.threadvar.}: PRope # the root of the cache tree
|
||||||
N: PRope # dummy rope needed for splay algorithm
|
N {.threadvar.}: PRope # dummy rope needed for splay algorithm
|
||||||
|
|
||||||
when countCacheMisses:
|
when countCacheMisses:
|
||||||
var misses, hits: int
|
var misses, hits: int
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,8 @@ proc getFormatArg(p: var TFormatParser, a: openArray[string]): int =
|
||||||
if result >=% a.len: raiseInvalidFormat("index out of bounds: " & $result)
|
if result >=% a.len: raiseInvalidFormat("index out of bounds: " & $result)
|
||||||
p.i = i
|
p.i = i
|
||||||
|
|
||||||
proc scanDollar(p: var TFormatParser, a: openarray[string], s: var string)
|
proc scanDollar(p: var TFormatParser, a: openarray[string], s: var string) {.
|
||||||
|
noSideEffect.}
|
||||||
|
|
||||||
proc emitChar(p: var TFormatParser, x: var string, ch: char) {.inline.} =
|
proc emitChar(p: var TFormatParser, x: var string, ch: char) {.inline.} =
|
||||||
x.add(ch)
|
x.add(ch)
|
||||||
|
|
|
||||||
|
|
@ -2567,11 +2567,11 @@ when not defined(JS): #and not defined(NimrodVM):
|
||||||
include "system/assign"
|
include "system/assign"
|
||||||
include "system/repr"
|
include "system/repr"
|
||||||
|
|
||||||
proc getCurrentException*(): ref E_Base {.compilerRtl, inl.} =
|
proc getCurrentException*(): ref E_Base {.compilerRtl, inl, gcsafe.} =
|
||||||
## retrieves the current exception; if there is none, nil is returned.
|
## retrieves the current exception; if there is none, nil is returned.
|
||||||
result = currException
|
result = currException
|
||||||
|
|
||||||
proc getCurrentExceptionMsg*(): string {.inline.} =
|
proc getCurrentExceptionMsg*(): string {.inline, gcsafe.} =
|
||||||
## retrieves the error message that was attached to the current
|
## retrieves the error message that was attached to the current
|
||||||
## exception; if there is none, "" is returned.
|
## exception; if there is none, "" is returned.
|
||||||
var e = getCurrentException()
|
var e = getCurrentException()
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ proc chckRangeF(x, a, b: float): float {.inline, compilerproc, gcsafe.}
|
||||||
proc chckNil(p: pointer) {.noinline, compilerproc, gcsafe.}
|
proc chckNil(p: pointer) {.noinline, compilerproc, gcsafe.}
|
||||||
|
|
||||||
var
|
var
|
||||||
framePtr {.rtlThreadVar.}: PFrame
|
framePtr {.threadvar.}: PFrame
|
||||||
excHandler {.rtlThreadVar.}: PSafePoint
|
excHandler {.threadvar.}: PSafePoint
|
||||||
# list of exception handlers
|
# list of exception handlers
|
||||||
# a global variable for the root of all try blocks
|
# a global variable for the root of all try blocks
|
||||||
currException {.rtlThreadVar.}: ref E_Base
|
currException {.threadvar.}: ref E_Base
|
||||||
|
|
||||||
proc popFrame {.compilerRtl, inl.} =
|
proc popFrame {.compilerRtl, inl.} =
|
||||||
framePtr = framePtr.prev
|
framePtr = framePtr.prev
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ proc serve() {.async.} =
|
||||||
await processClient(fut)
|
await processClient(fut)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
|
proc main =
|
||||||
var fut = serve()
|
var fut = serve()
|
||||||
fut.callback =
|
fut.callback =
|
||||||
proc () =
|
proc () =
|
||||||
|
|
@ -36,3 +37,4 @@ when isMainModule:
|
||||||
# as it is not handled.
|
# as it is not handled.
|
||||||
raise fut.error
|
raise fut.error
|
||||||
runForever()
|
runForever()
|
||||||
|
main()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ discard """
|
||||||
"""
|
"""
|
||||||
import sockets, asyncio, strutils, times
|
import sockets, asyncio, strutils, times
|
||||||
|
|
||||||
var disp = newDispatcher()
|
var disp {.threadvar.}: PDispatcher
|
||||||
|
disp = newDispatcher()
|
||||||
var msgCount = 0
|
var msgCount = 0
|
||||||
|
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue