using timeout on thread