From 57e54d84d641787d40a2b45549f6f2d373c5f2f2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 16 Aug 2011 23:05:08 +0100
Subject: 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.
---
OpenSim/Framework/AvatarAppearance.cs | 12 ++++++++++--
OpenSim/Framework/Util.cs | 11 ++++++++++-
2 files changed, 20 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 02af5d9..ab4ed66 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -412,12 +412,20 @@ namespace OpenSim.Framework
}
///
- /// Add an attachment, if the attachpoint has the
+ /// Add an attachment
+ ///
+ ///
+ /// If the attachpoint has the
/// 0x80 bit set then we assume this is an append
/// operation otherwise we replace whatever is
/// currently attached at the attachpoint
+ ///
+ ///
+ /// If UUID.Zero, then an any attachment at the attachpoint is removed.
+ ///
+ ///
/// return true if something actually changed
- ///
+ ///
public bool SetAttachment(int attachpoint, UUID item, UUID asset)
{
if (attachpoint == 0)
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
///
/// The method used by Util.FireAndForget for asynchronously firing events
///
+ ///
+ /// None is used to execute the method in the same thread that made the call. It should only be used by regression
+ /// test code that relies on predictable event ordering.
+ ///
public enum FireAndForgetMethod
{
+ None,
UnsafeQueueUserWorkItem,
QueueUserWorkItem,
BeginInvoke,
@@ -89,7 +94,8 @@ namespace OpenSim.Framework
public static readonly Regex UUIDPattern
= 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}$");
- public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
+ public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
+ public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod;
///
/// Gets the name of the directory where the current running executable
@@ -1506,6 +1512,9 @@ namespace OpenSim.Framework
switch (FireAndForgetMethod)
{
+ case FireAndForgetMethod.None:
+ realCallback.Invoke(obj);
+ break;
case FireAndForgetMethod.UnsafeQueueUserWorkItem:
ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj);
break;
--
cgit v1.1