aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorMelanie2011-12-09 08:13:57 +0000
committerMelanie2011-12-09 08:13:57 +0000
commitd9133038755180da5378729985b2aca6dc33b425 (patch)
treef70530bacb9b22d6f2f20ec8dfa7e1dd9b755f2b /OpenSim/Framework/Util.cs
parentMerge branch 'bigmerge' of ssh://melanie@3dhosting.de/var/git/careminster int... (diff)
parentRevert "Revert "Stop performing the asset save part of baked texture uploadin... (diff)
downloadopensim-SC_OLD-d9133038755180da5378729985b2aca6dc33b425.zip
opensim-SC_OLD-d9133038755180da5378729985b2aca6dc33b425.tar.gz
opensim-SC_OLD-d9133038755180da5378729985b2aca6dc33b425.tar.bz2
opensim-SC_OLD-d9133038755180da5378729985b2aca6dc33b425.tar.xz
Merge branch 'master' into bigmerge
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs45
1 files changed, 29 insertions, 16 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0b2fbb9..fae6802 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -58,10 +58,12 @@ namespace OpenSim.Framework
58 /// <remarks> 58 /// <remarks>
59 /// None is used to execute the method in the same thread that made the call. It should only be used by regression 59 /// None is used to execute the method in the same thread that made the call. It should only be used by regression
60 /// test code that relies on predictable event ordering. 60 /// test code that relies on predictable event ordering.
61 /// RegressionTest is used by regression tests. It fires the call synchronously and does not catch any exceptions.
61 /// </remarks> 62 /// </remarks>
62 public enum FireAndForgetMethod 63 public enum FireAndForgetMethod
63 { 64 {
64 None, 65 None,
66 RegressionTest,
65 UnsafeQueueUserWorkItem, 67 UnsafeQueueUserWorkItem,
66 QueueUserWorkItem, 68 QueueUserWorkItem,
67 BeginInvoke, 69 BeginInvoke,
@@ -1556,27 +1558,38 @@ namespace OpenSim.Framework
1556 1558
1557 public static void FireAndForget(System.Threading.WaitCallback callback, object obj) 1559 public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
1558 { 1560 {
1559 // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture 1561 WaitCallback realCallback;
1560 // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas
1561 // for decimals places but is read by a culture that treats commas as number seperators.
1562 WaitCallback realCallback = delegate(object o)
1563 {
1564 Culture.SetCurrentCulture();
1565 1562
1566 try 1563 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
1567 { 1564 {
1568 callback(o); 1565 // If we're running regression tests, then we want any exceptions to rise up to the test code.
1569 } 1566 realCallback = o => { Culture.SetCurrentCulture(); callback(o); };
1570 catch (Exception e) 1567 }
1568 else
1569 {
1570 // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture
1571 // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas
1572 // for decimals places but is read by a culture that treats commas as number seperators.
1573 realCallback = o =>
1571 { 1574 {
1572 m_log.ErrorFormat( 1575 Culture.SetCurrentCulture();
1573 "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}", 1576
1574 e.Message, e.StackTrace); 1577 try
1575 } 1578 {
1576 }; 1579 callback(o);
1580 }
1581 catch (Exception e)
1582 {
1583 m_log.ErrorFormat(
1584 "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}",
1585 e.Message, e.StackTrace);
1586 }
1587 };
1588 }
1577 1589
1578 switch (FireAndForgetMethod) 1590 switch (FireAndForgetMethod)
1579 { 1591 {
1592 case FireAndForgetMethod.RegressionTest:
1580 case FireAndForgetMethod.None: 1593 case FireAndForgetMethod.None:
1581 realCallback.Invoke(obj); 1594 realCallback.Invoke(obj);
1582 break; 1595 break;