wait for the UI thread to complete or cancel the wait
Is there any reason you don't just use the cancellation token to stop the thread? I'm also wondering why you're using an explicit thread at all. This is asynchronous programming the hard way. async-await and Tasks are the idiomatic way to do this for the last several versions of the language &amp; framework. 

I'm imagining your code looking something like this. (Totally untested. Might not compile.)

public static void Main()
{
    var cts = new CancellationTokenSource();
    var token = cts.Token;

    Task.Run(()=&gt;
    {
        while (!Console.KeyAvailable)
        {
            if (token.IsCancellationRequested)
            {
                token.ThrowIfCancellationRequested();
            }

            await Task.Delay(50);
        }

        token.Cancel();
     }, token);

     Console.WriteLine("Press Any Key or don't...");

     await Task.Delay(50000, token);
     token.Cancel(); //task is still running, best to shut it down too
 }