I have encountered a 1 second delay in signal delivery, when I send a signal to a thread in python.
Sending thread snippet (import both signal and os (and time)):
print "Signal sent at:", time.time()
os.kill(other_thread_id, signal.SIGALRM)
Receiving thread snippet:
def receive_alarm(signum, stack):
print "Signal received at:", time.time()
signal.signal(signal.SIGALRM, receive_alarm)
Running both simultaneously gives:
Signal sent at 1423141616.02
Signal received at: 1423141617.02
So delivery of the alarm signal takes a full second. It's always exactly 1 second. This delay makes it unusable for my purpose. Does anyone know more about this? Is it a setting somewhere? Or am I doing something else wrong? I've tried other signals as well.
OS: Debian 7
UPDATE after comments below:
strace python main.py
DOESN'T give this delay.
python main.py
DOES :-). This might get us closer to what's wrong.