diff options
author | John Hurliman | 2009-10-26 16:33:04 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-26 16:33:04 -0700 |
commit | 4847e62e9fd1cd473cc180220a379efba93f94a6 (patch) | |
tree | 509da282d16f1cfa7d2500debc5b56c48799ec98 /OpenSim/Framework/Parallel.cs | |
parent | Added calls to GC.AddMemoryPressure() when unmanaged memory is allocated for ... (diff) | |
download | opensim-SC_OLD-4847e62e9fd1cd473cc180220a379efba93f94a6.zip opensim-SC_OLD-4847e62e9fd1cd473cc180220a379efba93f94a6.tar.gz opensim-SC_OLD-4847e62e9fd1cd473cc180220a379efba93f94a6.tar.bz2 opensim-SC_OLD-4847e62e9fd1cd473cc180220a379efba93f94a6.tar.xz |
* Switched all operations on the list of clients that could be either sync or async to use Scene.ForEachClient() instead of referencing ClientManager directly
* Added a new [Startup] config option called use_async_when_possible to signal how to run operations that could be either sync or async
* Changed Scene.ForEachClient to respect use_async_when_possible
* Fixing a potential deadlock in Parallel.ForEach by locking on a temporary object instead of the enumerator (which may be shared across multiple invocations on ForEach). Thank you diva
Diffstat (limited to 'OpenSim/Framework/Parallel.cs')
-rw-r--r-- | OpenSim/Framework/Parallel.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/OpenSim/Framework/Parallel.cs b/OpenSim/Framework/Parallel.cs index 70eecdc..515852f 100644 --- a/OpenSim/Framework/Parallel.cs +++ b/OpenSim/Framework/Parallel.cs | |||
@@ -118,6 +118,7 @@ namespace OpenSim.Framework | |||
118 | int counter = threadCount; | 118 | int counter = threadCount; |
119 | AutoResetEvent threadFinishEvent = new AutoResetEvent(false); | 119 | AutoResetEvent threadFinishEvent = new AutoResetEvent(false); |
120 | IEnumerator<T> enumerator = enumerable.GetEnumerator(); | 120 | IEnumerator<T> enumerator = enumerable.GetEnumerator(); |
121 | object syncRoot = new object(); | ||
121 | Exception exception = null; | 122 | Exception exception = null; |
122 | 123 | ||
123 | for (int i = 0; i < threadCount; i++) | 124 | for (int i = 0; i < threadCount; i++) |
@@ -131,7 +132,7 @@ namespace OpenSim.Framework | |||
131 | { | 132 | { |
132 | T entry; | 133 | T entry; |
133 | 134 | ||
134 | lock (enumerator) | 135 | lock (syncRoot) |
135 | { | 136 | { |
136 | if (!enumerator.MoveNext()) | 137 | if (!enumerator.MoveNext()) |
137 | break; | 138 | break; |