Timeline for Concise handling of async tasks with timeouts in c#
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 25, 2022 at 12:54 | vote | accept | Adriaan | ||
| Mar 25, 2022 at 11:05 | comment | added | Peter Csala | @Adriaan Done :) | |
| Mar 25, 2022 at 11:04 | answer | added | Peter Csala | timeline score: 2 | |
| Mar 25, 2022 at 9:47 | comment | added | Adriaan | @PeterCsala No, I was not aware of it, it looks like exactly what I wanted and way better than what I implemented! Please make that into an answer so I can accept it. I'll me moving my code to using that instead. | |
| Mar 25, 2022 at 7:47 | comment | added | Peter Csala | @Adriaan Are you aware of the Polly's Timeout policy? | |
| Mar 17, 2022 at 19:41 | answer | added | CharlesNRice | timeline score: 0 | |
| Mar 17, 2022 at 17:18 | comment | added | Adriaan | I changed my implementation and using CancelAfter doesn't make it any prettier... still requires a temp variable with multiple lines to achieve the simple timeout behaviour (see update to the question). So it still warrants being wrapped in an extension method in my opinion. | |
| Mar 17, 2022 at 17:16 | history | edited | Adriaan | CC BY-SA 4.0 |
added 403 characters in body
|
| Mar 17, 2022 at 17:05 | comment | added | Adriaan |
Ok, so then one can achieve pretty much the same as I'm doing by: CancellationTokenSource.CreateLinkedTokenSource(stoppingToken).CancelAfter(2000); instead of stoppingToken.NewWithTimeout(2000) I guess it's not too bad and doesn't require anything non-standard
|
|
| Mar 17, 2022 at 16:54 | comment | added | CharlesNRice | You should check out CancellationTokenSource specifically the CreateLinkedToken. You can make a new CancellationToken from two tokens and you can use the CancelAfter method to make a token that auto cancels after a TimeSpan | |
| S Mar 17, 2022 at 14:48 | review | First questions | |||
| Mar 17, 2022 at 19:44 | |||||
| S Mar 17, 2022 at 14:48 | history | asked | Adriaan | CC BY-SA 4.0 |