How do I make this thread aware of a process in a different thread
<p>Here is my code:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Timers;
using System.Diagnostics;

using System.Threading;

namespace ConsoleApplication2 {
    class Program {

        public static System.Timers.Timer aTimer;
        public static System.Diagnostics.Stopwatch sw;
        public static Boolean HasNotepadclosed;
        public static Process pr;

        static void Main(string[] args) {

            Boolean HasNotepadclosed = false;
            sw = new Stopwatch();

            pr = new Process();
            pr.StartInfo = new ProcessStartInfo(@"notepad.exe");
            pr.EnableRaisingEvents = true;
            pr.Exited += new EventHandler(YouClosedNotePad);
            pr.Start();


            aTimer = new System.Timers.Timer();
            aTimer.Interval = 500;
            aTimer.Elapsed += new ElapsedEventHandler(myGong);
            GC.KeepAlive(aTimer);

            Thread myFirstThread;
            myFirstThread = new Thread(new ThreadStart(HelloFirstThread));
            myFirstThread.Start();

            sw.Start();
            aTimer.Enabled = true;

            Console.WriteLine("press [enter] to exit");
            Console.ReadLine();
        }

        static void HelloFirstThread() {
            Console.WriteLine("we're in here now");
            Thread.Sleep(7000);
            if(HasNotepadclosed) {
                Console.WriteLine("bye bye: notepad open");
            } else {
                Console.WriteLine("bye bye: notepad closed");
            }

        }


        static void YouClosedNotePad(object sender, EventArgs e) {
            Console.WriteLine("thanks for closing notepad");
            HasNotepadclosed = true;
        }
        static void myGong(object sender, ElapsedEventArgs e) {
            Console.WriteLine("hello at {0} milliseconds elapsed = {1}", e.SignalTime, sw.ElapsedMilliseconds);
            if(sw.ElapsedMilliseconds &gt; 4000) {
                aTimer.Dispose();
            }
        }


    }
}
</code></pre>

<p>If I close notepad before <code>myFirstThread</code> has finished sleeping then I still get a final answer saying "bye bye: notepad open". Some how I need to make <code>myFirstThread</code> aware of what is going on in the original <code>thread</code> - is this easily done?</p>
