from the api docs: "If sleep_time > 0 the function will block for at
most the specified time in msecs."
so the attached callback have at most TIMEOUT msec to execute, it will
not always block till timeout.
Sure, but it actually never does anything, even with TIMEOUT == INT_MAX.
Additionally, given the relative complexity of the code, I think the
intent was not to just mimic: