{
var cts0 = new CancellationTokenSource();
var token0 = cts0.Token;
var cts1 = CancellationTokenSource.CreateLinkedTokenSource(token0);
var token1 = cts1.Token;
token0.IsCancellationRequested.Dump("token0 before cancelling cts0"); // false
token1.IsCancellationRequested.Dump("token1 before cancelling cts0"); // false
cts0.Cancel();
token0.IsCancellationRequested.Dump("token0 after cancelling cts0"); // true
token1.IsCancellationRequested.Dump("token1 after cancelling cts0"); // true
}
{
var cts0 = new CancellationTokenSource();
var token0 = cts0.Token;
var cts1 = CancellationTokenSource.CreateLinkedTokenSource(token0);
var token1 = cts1.Token;
token0.IsCancellationRequested.Dump("token0 before cancelling cts1"); // false
token1.IsCancellationRequested.Dump("token1 before cancelling cts1"); // false
cts1.Cancel();
token0.IsCancellationRequested.Dump("token0 after cancelling cts1"); // false
token1.IsCancellationRequested.Dump("token1 after cancelling cts1"); // true
}
использовать давно забытые примитивные конструкции типов (например, массив символов как буфер)
cell [noun] (biology) a very small piece of the substance of which all living things are made; the smallest unit of living matter
cage [noun] a box of wood, wire etc for holding birds or animals
crow’s-nest [noun] a shelter at the masthead of a ship, used as a lookout post.
shaft [noun] a long, narrow space, made for eg a lift in a building