4 years, 8 months ago.

How / Is there a way to cancel a Timeout?

I initiate a timeout for a duration. On completion, it will call a function. Is there a way to cancel the timeout, in case it is not used anymore for this run. For example, I want to read some value, but not want to wait more than a certain amount of time. I created a timeout , but in case the request complete before the timeout, I don't want to be called back. What would be the proper way to do it? Thanks

1 Answer

4 years, 8 months ago.

Typically the timeout is cancelled when you attach the NULL pointer to the Timeout object instead of the original function.