Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This requires the API you're using to support this. If the API doesn't, then using infinite timeout is a bad idea.


Of course. I did not mean to convey that timeouts should be avoided in all cases. In fact I listed several such cases where they should be used. An API that has no way to cancel would be another example. Although I would argue that such an API is fundamentally flawed.


Yeah I just wanted to highlight it, as I've see far too much code passing INFINITE to WaitForSingleObject or similar.

And yeah, not having another way of cancelling is not nice, but sadly not entirely uncommon.


Right I think the suggestion in that case would be to upgrade to an API that does support cancellation wherever possible. E.g. wait for multiple objects with the original argument and an additional cancel event.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: