I implemented a while loop with locks in python-2.7 (see example) to handle two lists which are loaded with values by an other thread each. The code works, but it will not handle SIGINT (Ctrl-C) anymore. Example:
while True:
with lock1:
if 0 < len(data_buf1):
foo(data_buf1.pop(0))
with lock2:
if 0 < len(data_buf2):
bar(data_buf2.pop(0)
What could I do to enable keyboard commands again?
Update The loop runs in the main python process.