fix failed tests due to gcsafe

This commit is contained in:
Araq 2014-08-12 10:11:58 +02:00
commit 4d863ebb5e
7 changed files with 55 additions and 50 deletions

View file

@ -588,6 +588,7 @@ proc register*(d: PDispatcher, ftp: PAsyncFTPClient): PDelegate {.discardable.}
return ftp.disp.register(ftp.asyncCSock)
when isMainModule:
proc main =
var d = newDispatcher()
let hev =
proc (ftp: PAsyncFTPClient, event: TFTPEvent) =
@ -620,7 +621,7 @@ when isMainModule:
echo "uploading..."
while true:
if not d.poll(): break
main()
when isMainModule and false:
var ftp = ftpClient("picheta.me", user = "asdasd", pass = "asfwq")

View file

@ -58,8 +58,8 @@ proc newRope(data: string): PRope =
result.data = data
var
cache: PRope # the root of the cache tree
N: PRope # dummy rope needed for splay algorithm
cache {.threadvar.}: PRope # the root of the cache tree
N {.threadvar.}: PRope # dummy rope needed for splay algorithm
when countCacheMisses:
var misses, hits: int

View file

@ -84,7 +84,8 @@ proc getFormatArg(p: var TFormatParser, a: openArray[string]): int =
if result >=% a.len: raiseInvalidFormat("index out of bounds: " & $result)
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.} =
x.add(ch)

View file

@ -2567,11 +2567,11 @@ when not defined(JS): #and not defined(NimrodVM):
include "system/assign"
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.
result = currException
proc getCurrentExceptionMsg*(): string {.inline.} =
proc getCurrentExceptionMsg*(): string {.inline, gcsafe.} =
## retrieves the error message that was attached to the current
## exception; if there is none, "" is returned.
var e = getCurrentException()

View file

@ -38,11 +38,11 @@ proc chckRangeF(x, a, b: float): float {.inline, compilerproc, gcsafe.}
proc chckNil(p: pointer) {.noinline, compilerproc, gcsafe.}
var
framePtr {.rtlThreadVar.}: PFrame
excHandler {.rtlThreadVar.}: PSafePoint
framePtr {.threadvar.}: PFrame
excHandler {.threadvar.}: PSafePoint
# list of exception handlers
# a global variable for the root of all try blocks
currException {.rtlThreadVar.}: ref E_Base
currException {.threadvar.}: ref E_Base
proc popFrame {.compilerRtl, inl.} =
framePtr = framePtr.prev

View file

@ -28,6 +28,7 @@ proc serve() {.async.} =
await processClient(fut)
when isMainModule:
proc main =
var fut = serve()
fut.callback =
proc () =
@ -36,3 +37,4 @@ when isMainModule:
# as it is not handled.
raise fut.error
runForever()
main()

View file

@ -5,7 +5,8 @@ discard """
"""
import sockets, asyncio, strutils, times
var disp = newDispatcher()
var disp {.threadvar.}: PDispatcher
disp = newDispatcher()
var msgCount = 0
when defined(ssl):