diff options
author | Steve Bennett <steveb@workware.net.au> | 2016-09-09 17:31:16 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2016-09-09 17:37:14 +1000 |
commit | 4baa884e739b59dfd50cbf606786c41de1d289a8 (patch) | |
tree | 575d5fa4f7e4be4a097f1b98613a87890ef3ae5e /jim-signal.c | |
parent | cf4ac87da5bba7e95dda8df09ef8ae63d1a2c5ee (diff) | |
download | jimtcl-4baa884e739b59dfd50cbf606786c41de1d289a8.zip jimtcl-4baa884e739b59dfd50cbf606786c41de1d289a8.tar.gz jimtcl-4baa884e739b59dfd50cbf606786c41de1d289a8.tar.bz2 |
signal: Remove the signal command from child interpreters
Currently signals can only be delivered to a single interpreter.
To avoid confusion where currently this is the most recently created
interpreter, don't create the signal command and handle signals in child interpreters.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-signal.c')
-rw-r--r-- | jim-signal.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/jim-signal.c b/jim-signal.c index b760ede..6785240 100644 --- a/jim-signal.c +++ b/jim-signal.c @@ -510,19 +510,23 @@ int Jim_signalInit(Jim_Interp *interp) if (Jim_PackageProvide(interp, "signal", "1.0", JIM_ERRMSG)) return JIM_ERR; - signal_init_names(); + Jim_CreateCommand(interp, "alarm", Jim_AlarmCmd, 0, 0); + Jim_CreateCommand(interp, "kill", Jim_KillCmd, 0, 0); + /* Sleep is slightly dubious here */ + Jim_CreateCommand(interp, "sleep", Jim_SleepCmd, 0, 0); /* Teach the jim core how to set a result from a sigmask */ interp->signal_set_result = signal_set_sigmask_result; - /* Make sure we know where to store the signals which occur */ - sigloc = &interp->sigmask; + /* Currently only the top level interp supports signals */ + if (!sigloc) { + signal_init_names(); - Jim_CreateCommand(interp, "signal", Jim_SubCmdProc, (void *)signal_command_table, NULL); - Jim_CreateCommand(interp, "alarm", Jim_AlarmCmd, 0, 0); - Jim_CreateCommand(interp, "kill", Jim_KillCmd, 0, 0); + /* Make sure we know where to store the signals which occur */ + sigloc = &interp->sigmask; + + Jim_CreateCommand(interp, "signal", Jim_SubCmdProc, (void *)signal_command_table, NULL); + } - /* Sleep is slightly dubious here */ - Jim_CreateCommand(interp, "sleep", Jim_SleepCmd, 0, 0); return JIM_OK; } |