thread based timeout, since signal based timeout cant do sub-second precision