I have following test code executed on Windows:
import multiprocessing
import time
def child() :
while True :
time.sleep( 2 )
if __name__ == '__main__' :
multiprocessing.Process( target = child ).start()
while True :
time.sleep( 1 )
If i press Ctrl-C
while it's working, i see two KeyboardInterrupt
exceptions - one for sleep( 1 )
and one for sleep( 2 )
. How it's happens that keyboard interrupt in main process
is forwarded to child process
? They are processes after all, not threads :(.