Timeout implementation for Windows based on threads.