HR timers prevent an itimer from generating EINTR?

From: Mike Heffner
Date: Fri Sep 04 2009 - 17:34:35 EST


Mixing HR timers with itimers occasionally hides an EINTR from a blocking syscall.


In my test program I have a High Resolution timer firing every one second (with SA_RESTART) and I set an itimer (without SA_RESTART) to fire after three seconds. I then execute a blocking system call (flock in this case) and expect the three second itimer to interrupt the system call with EINTR. However, I frequently notice that the itimer will fire but it will not interrupt the blocking system call. There appears to be a race between the HR timer firing and the itimer firing. If I offset the HR timer frequency by a half second, the itimer always interrupts the system call.

Kernel version:

These kernels both demonstrate the condition:

I do not see this condition on:


Test program:

The following program illustrates this condition:

Is this behavior expected?




Mike Heffner <mikeh@xxxxxxxxxx>

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at