Added XNA 4.0 XBox 360 project; fixed compilation errors that would result from compiling Nuclex.Support on the XBox 360's special compact framework
git-svn-id: file:///srv/devel/repo-conversion/nusu@202 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
5f5b8b519b
commit
1aad371ece
17 changed files with 533 additions and 26 deletions
|
@ -28,7 +28,9 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// This exception is the typical result of using AsyncAbort() on a running
|
||||
/// background process.
|
||||
/// </remarks>
|
||||
#if !NO_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
public class AbortedException : Exception {
|
||||
|
||||
/// <summary>Initializes the exception</summary>
|
||||
|
|
|
@ -92,8 +92,13 @@ namespace Nuclex.Support.Scheduling {
|
|||
// Force a timeout at least each second so the caller can check the system time
|
||||
// since we're not able to provide the DateTimeAdjusted notification
|
||||
int milliseconds = (int)(ticks / TicksPerMillisecond);
|
||||
#if XNA_3
|
||||
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds), false);
|
||||
|
||||
#elif XBOX360
|
||||
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds));
|
||||
#else
|
||||
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds), false);
|
||||
#endif
|
||||
// See whether the system date/time have been adjusted while we were asleep.
|
||||
checkForTimeAdjustment();
|
||||
|
||||
|
|
|
@ -128,7 +128,11 @@ namespace Nuclex.Support.Scheduling {
|
|||
|
||||
this.timerThread = new Thread(new ThreadStart(runTimerThread));
|
||||
this.timerThread.Name = "Nuclex.Support.Scheduling.Scheduler";
|
||||
#if XNA_3
|
||||
this.timerThread.Priority = ThreadPriority.Highest;
|
||||
#elif !XBOX360
|
||||
this.timerThread.Priority = ThreadPriority.Highest;
|
||||
#endif
|
||||
this.timerThread.IsBackground = true;
|
||||
this.timerThread.Start();
|
||||
}
|
||||
|
@ -142,10 +146,10 @@ namespace Nuclex.Support.Scheduling {
|
|||
// Wait for the timer thread to exit. If it doesn't exit in 10 seconds (which is
|
||||
// a lot of time given that it doesn't do any real work), forcefully abort
|
||||
// the thread. This may risk some leaks, but it's the only thing we can do.
|
||||
Trace.Assert(
|
||||
this.timerThread.Join(2500), "Scheduler timer thread did not exit in time"
|
||||
);
|
||||
|
||||
bool success = this.timerThread.Join(2500);
|
||||
#if !XBOX360
|
||||
Trace.Assert(success, "Scheduler timer thread did not exit in time");
|
||||
#endif
|
||||
// Unsubscribe from the time source to avoid surprise events during or
|
||||
// after shutdown
|
||||
if(this.timeSource != null) {
|
||||
|
|
|
@ -65,7 +65,13 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// True if the WaitHandle was signalled, false if the timeout was reached
|
||||
/// </returns>
|
||||
public override bool WaitOne(AutoResetEvent waitHandle, long ticks) {
|
||||
#if XNA_3
|
||||
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond), false);
|
||||
#elif XBOX360
|
||||
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond));
|
||||
#else
|
||||
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue