[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Threading Thread.cs,1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Threading Thread.cs,1.8,1.9 Timer.cs,1.4,1.5 |
Date: |
Tue, 01 Apr 2003 17:28:43 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Threading
In directory subversions:/tmp/cvs-serv27456/runtime/System/Threading
Modified Files:
Thread.cs Timer.cs
Log Message:
Add a new internallcall, "CanStartThreads", for detecting whether the
runtime engine can really start threads or not.
Index: Thread.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Threading/Thread.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Thread.cs 1 Apr 2003 02:45:48 -0000 1.8
--- Thread.cs 1 Apr 2003 22:28:41 -0000 1.9
***************
*** 317,320 ****
--- 317,325 ----
}
+ // Determine if the runtime engine can start threads.
+ // Returns false on a single-threaded system.
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ extern internal static bool CanStartThreads();
+
}; // class Thread
Index: Timer.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Threading/Timer.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Timer.cs 1 Apr 2003 22:17:38 -0000 1.4
--- Timer.cs 1 Apr 2003 22:28:41 -0000 1.5
***************
*** 78,84 ****
// Start the timer thread.
! timerThread = new Thread(new ThreadStart(Run));
! timerThread.IsBackground = true;
! timerThread.Start();
}
public Timer(TimerCallback callback, Object state,
--- 78,94 ----
// Start the timer thread.
! if(Thread.CanStartThreads())
! {
! timerThread = new Thread(new
ThreadStart(Run));
! timerThread.IsBackground = true;
! timerThread.Start();
! }
! else
! {
! // The system does not support
threading, so there
! // is no way to run the timer in
another thread.
! // So act as though the timeout will
never be fired.
! timerThread = null;
! }
}
public Timer(TimerCallback callback, Object state,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Threading Thread.cs,1.8,1.9 Timer.cs,1.4,1.5,
Rhys Weatherley <address@hidden> <=