That gets a lot harder than you think.
Why?
Partly because the code you show for your thread is really nasty: it will sit there outputting new lines to the COnsole as fast as it can, and causing your app to spend most of it's time allocating memory and scrolling the display...hence why your program hangs!
But mostly, because getting data between threads is fraught with problems, because therad are independent processes and you don't know what they are doing at any time from another thread: so if you are busy loading something into a variable in one thread, you don't know that the other is not half way through removing it. Just a simple thing like counting numbers up in one thread and reducing them in another becomes a source of horrible, horrible bugs.
If you really want to do this, then you need to start reading up first on designing for thread safe data transfer, but the simplest way is to involve the
lock statement[
^].