diff options
author | Araq <rumpf_a@web.de> | 2011-06-04 23:55:10 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-06-04 23:55:10 +0200 |
commit | 24ed9d560fb7a694c90dc0a378549a06600fcbd0 (patch) | |
tree | be0f8f2b0f44387e8e2c9b75c8db0506aece9a0b /lib/system.nim | |
parent | 5008b44467bf545287289087a13f7e53c3d242ff (diff) | |
download | Nim-24ed9d560fb7a694c90dc0a378549a06600fcbd0.tar.gz |
threads clean up their heap
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-x | lib/system.nim | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim index ef9685574..5250a7ae7 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -778,7 +778,7 @@ proc compileOption*(option, arg: string): bool {. const hasThreadSupport = compileOption("threads") - hasSharedHeap = false # don't share heaps, so every thread has its own heap + hasSharedHeap = defined(boehmgc) # don't share heaps; every thread has its own when hasThreadSupport and not hasSharedHeap: {.pragma: rtlThreadVar, threadvar.} @@ -1040,8 +1040,6 @@ proc getRefcount*[T](x: ref T): int {.importc: "getRefcount", noSideEffect.} ## retrieves the reference count of an heap-allocated object. The ## value is implementation-dependant. -#proc writeStackTrace() {.export: "writeStackTrace".} - # new constants: const inf* {.magic: "Inf".} = 1.0 / 0.0 @@ -1386,6 +1384,12 @@ var ## set this variable to provide a procedure that should be called before ## each executed instruction. This should only be used by debuggers! ## Only code compiled with the ``debugger:on`` switch calls this hook. + raiseHook*: proc (e: ref E_Base): bool + ## with this hook you can influence exception handling on a global level. + ## If not nil, every 'raise' statement ends up calling this hook. Ordinary + ## application code should never set this hook! You better know what you + ## do when setting this. If ``raiseHook`` returns false, the exception + ## is caught and does not propagate further through the call stack. type PFrame = ptr TFrame @@ -1420,8 +1424,13 @@ else: """ proc echo*[Ty](x: openarray[Ty]) {.magic: "Echo".} - ## equivalent to ``writeln(stdout, x); flush(stdout)``. BUT: This is - ## available for the ECMAScript target too! + ## special built-in that takes a variable number of arguments. Each argument + ## is converted to a string via ``$``, so it works for user-defined + ## types that have an overloaded ``$`` operator. + ## It is roughly equivalent to ``writeln(stdout, x); flush(stdout)``, but + ## available for the ECMAScript target too. + ## Unlike other IO operations this is guaranteed to be thread-safe as + ## ``echo`` is very often used for debugging convenience. template newException*(exceptn, message: expr): expr = ## creates an exception object of type ``exceptn`` and sets its ``msg`` field |