コード例 #1
0
 public static int Main(String[] args) {
 Console.WriteLine("CO_Mutex.cs ...");
 gMutex = new Mutex(false,"MyMutex");
 try								{	gMutex.ReleaseMutex( );				}
 catch (ApplicationException)	{	Console.WriteLine("o.k. AppEx");	}
 CO_Mutex tm = new CO_Mutex();
 Thread	t1	= new Thread(new ThreadStart(tm.T1start));
 Thread	t2	= new Thread(new ThreadStart(tm.T2start));
 t1.Start();
 t2.Start();
 AutoResetEvent[] evs = new AutoResetEvent[2];
 evs[0] = Event1;
 evs[1] = Event2;
 WaitHandle.WaitAll(evs);
 Console.WriteLine("... CO_Mutex.cs");
 return 0;
 }
コード例 #2
0
    public static int Main(String[] args)
    {
        Console.WriteLine("CO_Mutex.cs ...");
        gMutex = new Mutex(false, "MyMutex");
        try                                                            { gMutex.ReleaseMutex( ); }
        catch (ApplicationException)   { Console.WriteLine("o.k. AppEx"); }
        CO_Mutex tm = new CO_Mutex();
        Thread   t1 = new Thread(new ThreadStart(tm.T1start));
        Thread   t2 = new Thread(new ThreadStart(tm.T2start));

        t1.Start();
        t2.Start();
        AutoResetEvent[] evs = new AutoResetEvent[2];
        evs[0] = Event1;
        evs[1] = Event2;
        WaitHandle.WaitAll(evs);
        Console.WriteLine("... CO_Mutex.cs");
        return(0);
    }