diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /ThirdParty/SmartThreadPool/EventWaitHandle.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'ThirdParty/SmartThreadPool/EventWaitHandle.cs')
-rw-r--r-- | ThirdParty/SmartThreadPool/EventWaitHandle.cs | 30 |
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 |