signal: Add basic signal implementation (only IGN & DFL are supported).

pull/20/merge
Paul Sokolovsky 2015-01-14 01:53:22 +02:00
rodzic 2441900796
commit b35135ef13
1 zmienionych plików z 18 dodań i 0 usunięć

18
signal/signal.py 100644
Wyświetl plik

@ -0,0 +1,18 @@
import _libc
SIG_DFL = 0
SIG_IGN = 1
SIGINT = 2
SIGPIPE = 13
SIGTERM = 15
libc = _libc.get()
signal_ = libc.func("i", "signal", "ii")
def signal(n, handler):
if isinstance(handler, int):
return signal_(n, handler)
raise NotImplementedError