diff options
author | Justin Clark-Casey (justincc) | 2011-08-16 23:05:08 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-16 23:05:08 +0100 |
commit | 57e54d84d641787d40a2b45549f6f2d373c5f2f2 (patch) | |
tree | 2a9dfca1ecde4281a59ec682d833c1007ccafbd2 /OpenSim/Framework/Util.cs | |
parent | Move some previously common code back into separate tests. Remove unused reg... (diff) | |
download | opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.zip opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.gz opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.bz2 opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.xz |
Add new FireAndForgetMethod.None.
This executes the callback on the same thread that made the request. Designed for use only by regression tests that rely on a predicable event ordering.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 984a7a8..51ced7b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -56,8 +56,13 @@ namespace OpenSim.Framework | |||
56 | /// <summary> | 56 | /// <summary> |
57 | /// The method used by Util.FireAndForget for asynchronously firing events | 57 | /// The method used by Util.FireAndForget for asynchronously firing events |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <remarks> | ||
60 | /// None is used to execute the method in the same thread that made the call. It should only be used by regression | ||
61 | /// test code that relies on predictable event ordering. | ||
62 | /// </remarks> | ||
59 | public enum FireAndForgetMethod | 63 | public enum FireAndForgetMethod |
60 | { | 64 | { |
65 | None, | ||
61 | UnsafeQueueUserWorkItem, | 66 | UnsafeQueueUserWorkItem, |
62 | QueueUserWorkItem, | 67 | QueueUserWorkItem, |
63 | BeginInvoke, | 68 | BeginInvoke, |
@@ -89,7 +94,8 @@ namespace OpenSim.Framework | |||
89 | public static readonly Regex UUIDPattern | 94 | public static readonly Regex UUIDPattern |
90 | = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); | 95 | = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); |
91 | 96 | ||
92 | public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; | 97 | public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; |
98 | public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod; | ||
93 | 99 | ||
94 | /// <summary> | 100 | /// <summary> |
95 | /// Gets the name of the directory where the current running executable | 101 | /// Gets the name of the directory where the current running executable |
@@ -1506,6 +1512,9 @@ namespace OpenSim.Framework | |||
1506 | 1512 | ||
1507 | switch (FireAndForgetMethod) | 1513 | switch (FireAndForgetMethod) |
1508 | { | 1514 | { |
1515 | case FireAndForgetMethod.None: | ||
1516 | realCallback.Invoke(obj); | ||
1517 | break; | ||
1509 | case FireAndForgetMethod.UnsafeQueueUserWorkItem: | 1518 | case FireAndForgetMethod.UnsafeQueueUserWorkItem: |
1510 | ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); | 1519 | ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); |
1511 | break; | 1520 | break; |