add unsetControlCHook to remove a Ctrl-C hook after it was set (#7267)
* add unsetControlCHook to remove a Ctrl-C hook after it was set Adds the inverse proc to setControlCHook in order to lift a Ctrl-C hook after it has been set. * remove check for noSignalHandler in system/excpt.nim
This commit is contained in:
parent
d998cb58dd
commit
8e600b78ca
3 changed files with 10 additions and 0 deletions
|
|
@ -536,3 +536,8 @@ proc setControlCHook(hook: proc () {.noconv.}) =
|
|||
# ugly cast, but should work on all architectures:
|
||||
type SignalHandler = proc (sign: cint) {.noconv, benign.}
|
||||
c_signal(SIGINT, cast[SignalHandler](hook))
|
||||
|
||||
when not defined(useNimRtl):
|
||||
proc unsetControlCHook() =
|
||||
# proc to unset a hook set by setControlCHook
|
||||
c_signal(SIGINT, signalHandler)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue