aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/EventWaitHandle.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ThirdParty/SmartThreadPool/EventWaitHandle.cs30
1 files changed, 15 insertions, 15 deletions
diff --git a/ThirdParty/SmartThreadPool/EventWaitHandle.cs b/ThirdParty/SmartThreadPool/EventWaitHandle.cs
index 25be07a..b7983cd 100644
--- a/ThirdParty/SmartThreadPool/EventWaitHandle.cs
+++ b/ThirdParty/SmartThreadPool/EventWaitHandle.cs
@@ -36,34 +36,34 @@ namespace Amib.Threading.Internal
36 return waitHandle.WaitOne(millisecondsTimeout, exitContext); 36 return waitHandle.WaitOne(millisecondsTimeout, exitContext);
37 } 37 }
38 38
39 private static IntPtr[] PrepareNativeHandles(WaitHandle[] waitHandles) 39 private static IntPtr[] PrepareNativeHandles(WaitHandle[] waitHandles)
40 { 40 {
41 IntPtr[] nativeHandles = new IntPtr[waitHandles.Length]; 41 IntPtr[] nativeHandles = new IntPtr[waitHandles.Length];
42 for (int i = 0; i < waitHandles.Length; i++) 42 for (int i = 0; i < waitHandles.Length; i++)
43 { 43 {
44 nativeHandles[i] = waitHandles[i].Handle; 44 nativeHandles[i] = waitHandles[i].Handle;
45 } 45 }
46 return nativeHandles; 46 return nativeHandles;
47 } 47 }
48 48
49 public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) 49 public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
50 { 50 {
51 uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout; 51 uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
52 52
53 IntPtr[] nativeHandles = PrepareNativeHandles(waitHandles); 53 IntPtr[] nativeHandles = PrepareNativeHandles(waitHandles);
54 54
55 int result = WaitForMultipleObjects((uint)waitHandles.Length, nativeHandles, true, timeout); 55 int result = WaitForMultipleObjects((uint)waitHandles.Length, nativeHandles, true, timeout);
56 56
57 if (result == WAIT_TIMEOUT || result == WAIT_FAILED) 57 if (result == WAIT_TIMEOUT || result == WAIT_FAILED)
58 { 58 {
59 return false; 59 return false;
60 } 60 }
61 61
62 return true; 62 return true;
63 } 63 }
64 64
65 65
66 public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) 66 public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
67 { 67 {
68 uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout; 68 uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
69 69
@@ -90,7 +90,7 @@ namespace Amib.Threading.Internal
90 90
91 return WaitAny(waitHandles, millisecondsTimeout, false); 91 return WaitAny(waitHandles, millisecondsTimeout, false);
92 } 92 }
93 93
94 #endregion 94 #endregion
95 95
96 #region External methods 96 #region External methods