thread local vs. global system.raiseHook
This commit is contained in:
parent
a757a08ab7
commit
2b323c638c
4 changed files with 22 additions and 8 deletions
|
|
@ -1447,11 +1447,20 @@ var
|
||||||
## set this variable to provide a procedure that should be called before
|
## set this variable to provide a procedure that should be called before
|
||||||
## each executed instruction. This should only be used by debuggers!
|
## each executed instruction. This should only be used by debuggers!
|
||||||
## Only code compiled with the ``debugger:on`` switch calls this hook.
|
## Only code compiled with the ``debugger:on`` switch calls this hook.
|
||||||
raiseHook*: proc (e: ref E_Base): bool
|
globalRaiseHook*: proc (e: ref E_Base): bool
|
||||||
## with this hook you can influence exception handling on a global level.
|
## with this hook you can influence exception handling on a global level.
|
||||||
## If not nil, every 'raise' statement ends up calling this hook. Ordinary
|
## If not nil, every 'raise' statement ends up calling this hook. Ordinary
|
||||||
## application code should never set this hook! You better know what you
|
## application code should never set this hook! You better know what you
|
||||||
## do when setting this. If ``raiseHook`` returns false, the exception
|
## do when setting this. If ``globalRaiseHook`` returns false, the
|
||||||
|
## exception is caught and does not propagate further through the call
|
||||||
|
## stack.
|
||||||
|
|
||||||
|
localRaiseHook* {.threadvar.}: proc (e: ref E_Base): bool
|
||||||
|
## with this hook you can influence exception handling on a
|
||||||
|
## thread local 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 ``localRaiseHook`` returns false, the exception
|
||||||
## is caught and does not propagate further through the call stack.
|
## is caught and does not propagate further through the call stack.
|
||||||
|
|
||||||
outOfMemHook*: proc
|
outOfMemHook*: proc
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,10 @@ proc quitOrDebug() {.inline.} =
|
||||||
|
|
||||||
proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} =
|
proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} =
|
||||||
e.name = ename
|
e.name = ename
|
||||||
if raiseHook != nil:
|
if localRaiseHook != nil:
|
||||||
if not raiseHook(e): return
|
if not localRaiseHook(e): return
|
||||||
|
if globalRaiseHook != nil:
|
||||||
|
if not globalRaiseHook(e): return
|
||||||
if excHandler != nil:
|
if excHandler != nil:
|
||||||
pushCurrentException(e)
|
pushCurrentException(e)
|
||||||
c_longjmp(excHandler.context, 1)
|
c_longjmp(excHandler.context, 1)
|
||||||
|
|
|
||||||
8
todo.txt
8
todo.txt
|
|
@ -6,11 +6,7 @@ Version 0.8.14
|
||||||
- fix actors.nim
|
- fix actors.nim
|
||||||
- make threadvar efficient again on linux after testing
|
- make threadvar efficient again on linux after testing
|
||||||
- test the sort implementation again
|
- test the sort implementation again
|
||||||
- optional indentation for 'case' statement
|
|
||||||
- document & test splicing; don't forget to test negative indexes
|
- document & test splicing; don't forget to test negative indexes
|
||||||
- thread local vs. global raiseHook()
|
|
||||||
- make pegs support a compile-time option and make c2nim use regexes instead
|
|
||||||
per default
|
|
||||||
- implement lib/pure/memfiles properly
|
- implement lib/pure/memfiles properly
|
||||||
|
|
||||||
incremental compilation
|
incremental compilation
|
||||||
|
|
@ -32,6 +28,7 @@ version 0.9.0
|
||||||
|
|
||||||
- const ptr/ref
|
- const ptr/ref
|
||||||
- unsigned ints and bignums
|
- unsigned ints and bignums
|
||||||
|
- implement the high level optimizer
|
||||||
- warning for implicit openArray -> varargs convention
|
- warning for implicit openArray -> varargs convention
|
||||||
- implement explicit varargs
|
- implement explicit varargs
|
||||||
- tests: run the GC tests
|
- tests: run the GC tests
|
||||||
|
|
@ -43,6 +40,7 @@ version 0.9.0
|
||||||
- os module should use Windows Unicode versions
|
- os module should use Windows Unicode versions
|
||||||
- 64bit build for Windows
|
- 64bit build for Windows
|
||||||
- codegen should use "NIM_CAST" macro and respect aliasing rules for GCC
|
- codegen should use "NIM_CAST" macro and respect aliasing rules for GCC
|
||||||
|
- optional indentation for 'case' statement
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
|
|
@ -74,6 +72,8 @@ version 0.9.XX
|
||||||
- 'nimrod def': does not always work?
|
- 'nimrod def': does not always work?
|
||||||
- test branch coverage
|
- test branch coverage
|
||||||
- checked exceptions
|
- checked exceptions
|
||||||
|
- make pegs support a compile-time option and make c2nim use regexes instead
|
||||||
|
per default?
|
||||||
- fix implicit generic routines
|
- fix implicit generic routines
|
||||||
- think about ``{:}.toTable[int, string]()``
|
- think about ``{:}.toTable[int, string]()``
|
||||||
- mocking support with ``tyProxy`` that does:
|
- mocking support with ``tyProxy`` that does:
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ Changes affecting backwards compatibility
|
||||||
- The threading API has been completely redesigned.
|
- The threading API has been completely redesigned.
|
||||||
- The ``unidecode`` module is now thread-safe and its interface has changed.
|
- The ``unidecode`` module is now thread-safe and its interface has changed.
|
||||||
- The ``bind`` expression is deprecated, use a ``bind`` declaration instead.
|
- The ``bind`` expression is deprecated, use a ``bind`` declaration instead.
|
||||||
|
- ``system.raiseHook`` is now split into ``system.localRaiseHook`` and
|
||||||
|
``system.globalRaiseHook`` to distinguish between thread local and global
|
||||||
|
raise hooks.
|
||||||
|
|
||||||
|
|
||||||
Language Additions
|
Language Additions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue