mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
* 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
This commit is contained in:
@@ -118,6 +118,7 @@ namespace OpenSim.Framework
|
||||
int counter = threadCount;
|
||||
AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
|
||||
IEnumerator<T> enumerator = enumerable.GetEnumerator();
|
||||
object syncRoot = new object();
|
||||
Exception exception = null;
|
||||
|
||||
for (int i = 0; i < threadCount; i++)
|
||||
@@ -131,7 +132,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
T entry;
|
||||
|
||||
lock (enumerator)
|
||||
lock (syncRoot)
|
||||
{
|
||||
if (!enumerator.MoveNext())
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user