One common use case for cancel tokens is "throw away all the old stuff, we have new orders". For example, when a browser browses to a new page it discards the old page.
Would have two methods (perhaps with shorter names): cancelCurrentAndReturnNewToken, currentToken. Perhaps also a cancelCurrentToken method.
Possible names: CancelTokenExchanger, SerialCancelTokenSource, RevolvingCancelTokenSource, ParenticidalCancelTokenSource.
One common use case for cancel tokens is "throw away all the old stuff, we have new orders". For example, when a browser browses to a new page it discards the old page.
Would have two methods (perhaps with shorter names):
cancelCurrentAndReturnNewToken,currentToken. Perhaps also acancelCurrentTokenmethod.Possible names:
CancelTokenExchanger,SerialCancelTokenSource,RevolvingCancelTokenSource,ParenticidalCancelTokenSource.