blob: 87ee5ecebbf0d33fc0de96002401ba0baaad0ca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
Signal Extension (package Signal) Version 1.4.0.1 available
See all my Tcl extensions at http://www.du.edu/~mschwart/tcl-tk.html
http://www.nyx.net/~mschwart/signal_ext.html
This extension adds dynamically loadable signal handling to Tcl/Tk scripts.
It provides a very limited subset of the functionality of tclX (just the
signal part, and about 3/4 of the functions for signals), but as a result
is quite small and quick to load.
Version 1.4 removes dependencies on Tk.
Tilman Kranz (tilde@tk-sls.de) patched this for wider portability on Linux
A summary of the extension usage follows:
Usages:
signal add signo proc [-async]
Adds a signal handler for signal signo through proc proc.
Signals can be provided by number, or the most common ones are provided by
name (e.g., SIGHUP).
The proc is any Tcl procedure, and it is evaluated when the signal comes in.
It will be provided no arguments.
Signal handlers have Posix semantics--they persist until reset.
If -async is used, the signal handler is created using Tcl_AsyncCreate().
Checks for the signal are very frequent (each evaluation) using this
technique, but one doesn't know quite where evaluation is or how to handle
errors in this situation. The code will evaluate the provided procedure in
the current interpreter if available, and in the interpreter which added the
signal handler otherwise. At least until a better scheme is suggested.
The -async is especially useful to interrupt "runaway" procs, or to cause a
quick exit; the default mechanism simply waits for another MainLoop cycle.
signal delete signo
Restores handling of signal signo to the default (SIG_DFL).
signal print
Prints the handling of all signals with handlers.
Formatted as signal ----> procedure
or as signal !---> procedure
if the signal is handled asynchronously
signal print signo
Prints the procedure for handling signal signo.
Prints the word UNHANDLED if no signal handler is active for that signal.
signal version
Returns the string representing the current version of the package
|