- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.8k
 
Description
Is your feature request related to a problem? Please describe.
From within a library, I want to detect whether the tokio context from the calling application is being shutdown to properly clean things up instead of emitting undesired errors. Right now, I'm getting: Error { kind: IOError(Custom { kind: Other, error: "A Tokio 1.x context was found, but it is being shutdown." } which I then forward to the calling application.
Describe the solution you'd like
Something like handle.is_shutting_down() or even a basic tokio::is_shutdown_error(err) would be perfect to be able to handle this scenario.
Describe alternatives you've considered
Alternative is letting the application handle this, but this is only moving the problem around, I think.
I could also match on the error message, but it's not exported by tokio and might as well change at some point