diff options
author | Justin Clark-Casey (justincc) | 2013-02-12 21:34:12 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-12 21:34:12 +0000 |
commit | a82bd5678ec14ea45f7ddcf54e4dd0af43b64c8c (patch) | |
tree | f54b50be843f78eb225c6b517913db89c2058d57 /OpenSim/Region/ScriptEngine/XEngine | |
parent | Re-enable subtest for single quoted token in TestJsonSetValueJson() (diff) | |
download | opensim-SC_OLD-a82bd5678ec14ea45f7ddcf54e4dd0af43b64c8c.zip opensim-SC_OLD-a82bd5678ec14ea45f7ddcf54e4dd0af43b64c8c.tar.gz opensim-SC_OLD-a82bd5678ec14ea45f7ddcf54e4dd0af43b64c8c.tar.bz2 opensim-SC_OLD-a82bd5678ec14ea45f7ddcf54e4dd0af43b64c8c.tar.xz |
Use an integer when specifying the XWorkItem wait rather than a TimeSpan to avoid a Windows casting issue in SmartThreadPool for large TimeSpans.
TimeSpan.Milliseconds is an int64. However, STP casts this to an int (32-bit).
If TimeSpan.MaxValue is given then the casting results in an invalid value for the SDK WaitHandle.WaitAll() call.
This was causing the co-op script termination regression tests to fail on Windows but not Mono 2.10.8 (which is perhaps not strict in the negative values that it accepts).
Solution here is to use the int millisecondsTimeout STP call rather than the TimeSpan one.
This also allows us to more clearly specify Timeout.Infinite rather than TimeSpan.MaxValue
Thanks to Teravus for this spot.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs b/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs index 2ac5c31..8dd7677 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs | |||
@@ -57,8 +57,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
57 | wr.Abort(); | 57 | wr.Abort(); |
58 | } | 58 | } |
59 | 59 | ||
60 | public bool Wait(TimeSpan t) | 60 | public bool Wait(int t) |
61 | { | 61 | { |
62 | // We use the integer version of WaitAll because the current version of SmartThreadPool has a bug with the | ||
63 | // TimeSpan version. The number of milliseconds in TimeSpan is an int64 so when STP casts it down to an | ||
64 | // int (32-bit) we can end up with bad values. This occurs on Windows though curious not on Mono 2.10.8 | ||
65 | // (or very likely other versions of Mono at least up until 3.0.3). | ||
62 | return SmartThreadPool.WaitAll(new IWorkItemResult[] {wr}, t, false); | 66 | return SmartThreadPool.WaitAll(new IWorkItemResult[] {wr}, t, false); |
63 | } | 67 | } |
64 | } | 68 | } |