CancellationTokenSourceを使うのが比較的妥当なやり方かな
2でボタンを押したらcancellationTokenSource.Cancel()
無限ループ側の処理では適宜cancellationToken.ThrowIfCancellationRequested()