News for hackers. Stuff that matters.
Re:Don't trust default timeouts by magicalhippo on Saturday August 29, 2020 @10:30AM (#24316348)
This requires the API you're using to support this. If the API doesn't, then using infinite timeout is a bad idea.
Re:Don't trust default timeouts by asdfasgasdgasdg on Saturday August 29, 2020 @10:37AM (#24316387)
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.
Re:Don't trust default timeouts by magicalhippo on Saturday August 29, 2020 @10:44AM (#24316432)
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.

Re:Don't trust default timeouts by asdfasgasdgasdg on Saturday August 29, 2020 @10:49AM (#24316468)
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.