simplify DoubleDictionaryThreadAbortSafe because dotnet no longer has thread.abort. Name is not wrong but keep it for now

This commit is contained in:
UbitUmarov
2025-10-18 21:25:06 +01:00
parent ca11a13f97
commit d6c83aee6b
3 changed files with 176 additions and 334 deletions

View File

@@ -34,21 +34,19 @@ namespace OpenSim.Framework
/// A double dictionary that is thread abort safe.
/// </summary>
/// <remarks>
/// This adapts OpenMetaverse.DoubleDictionary to be thread-abort safe by acquiring ReaderWriterLockSlim within
/// a finally section (which can't be interrupted by Thread.Abort()).
/// </remarks>
public class DoubleDictionaryThreadAbortSafe<TKey1, TKey2, TValue>
{
Dictionary<TKey1, TValue> Dictionary1;
Dictionary<TKey2, TValue> Dictionary2;
readonly Dictionary<TKey1, TValue> Dictionary1;
readonly Dictionary<TKey2, TValue> Dictionary2;
private TValue[] m_array;
ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim();
readonly ReaderWriterLockSlim rwLock = new();
public DoubleDictionaryThreadAbortSafe()
{
Dictionary1 = new Dictionary<TKey1,TValue>();
Dictionary2 = new Dictionary<TKey2,TValue>();
Dictionary1 = [];
Dictionary2 = [];
m_array = null;
}
@@ -61,133 +59,102 @@ namespace OpenSim.Framework
~DoubleDictionaryThreadAbortSafe()
{
if(rwLock != null)
rwLock.Dispose();
rwLock?.Dispose();
}
public void Add(TKey1 key1, TKey2 key2, TValue value)
{
bool gotLock = false;
rwLock.EnterWriteLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterWriteLock();
gotLock = true;
}
Dictionary1[key1] = value;
Dictionary2[key2] = value;
m_array = null;
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
Dictionary1[key1] = value;
Dictionary2[key2] = value;
m_array = null;
}
finally { rwLock.ExitWriteLock(); }
}
public bool Remove(TKey1 key1, TKey2 key2)
{
bool success;
bool gotLock = false;
rwLock.EnterWriteLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterWriteLock();
gotLock = true;
}
success = Dictionary1.Remove(key1);
bool success = Dictionary1.Remove(key1);
success &= Dictionary2.Remove(key2);
m_array = null;
return success;
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
}
finally { rwLock.ExitWriteLock(); }
}
return success;
public bool Remove(TKey1 key1, TKey2 key2, out TValue value)
{
rwLock.EnterWriteLock();
try
{
bool success = Dictionary1.Remove(key1, out value);
success &= Dictionary2.Remove(key2);
m_array = null;
return success;
}
finally { rwLock.ExitWriteLock(); }
}
public bool Remove(TKey1 key1)
{
bool found = false;
bool gotLock = false;
rwLock.EnterWriteLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterWriteLock();
gotLock = true;
}
// This is an O(n) operation!
TValue value;
if (Dictionary1.TryGetValue(key1, out value))
{
if (Dictionary1.Remove(key1, out TValue value))
{
m_array = null;
foreach (KeyValuePair<TKey2, TValue> kvp in Dictionary2)
{
if (kvp.Value.Equals(value))
{
try { }
finally
{
Dictionary1.Remove(key1);
Dictionary2.Remove(kvp.Key);
m_array = null;
}
found = true;
break;
Dictionary2.Remove(kvp.Key);
return true;
}
}
}
return false;
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
}
finally { rwLock.ExitWriteLock(); }
}
return found;
public bool Remove(TKey1 key1, out TValue value)
{
rwLock.EnterWriteLock();
try
{
// This is an O(n) operation!
if (Dictionary1.Remove(key1, out value))
{
m_array = null;
foreach (KeyValuePair<TKey2, TValue> kvp in Dictionary2)
{
if (kvp.Value.Equals(value))
{
Dictionary2.Remove(kvp.Key);
return true;
}
}
}
return false;
}
finally { rwLock.ExitWriteLock(); }
}
public bool Remove(TKey2 key2)
{
bool found = false;
bool gotLock = false;
rwLock.EnterWriteLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterWriteLock();
gotLock = true;
}
// This is an O(n) operation!
TValue value;
if (Dictionary2.TryGetValue(key2, out value))
if (Dictionary2.Remove(key2, out TValue value))
{
m_array = null;
foreach (KeyValuePair<TKey1, TValue> kvp in Dictionary1)
{
if (kvp.Value.Equals(value))
@@ -195,49 +162,51 @@ namespace OpenSim.Framework
try { }
finally
{
Dictionary2.Remove(key2);
Dictionary1.Remove(kvp.Key);
m_array = null;
}
found = true;
break;
return true;
}
}
}
return false;
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
}
finally { rwLock.ExitWriteLock(); }
}
return found;
public bool Remove(TKey2 key2, out TValue value)
{
rwLock.EnterWriteLock();
try
{
// This is an O(n) operation!
if (Dictionary2.Remove(key2, out value))
{
m_array = null;
foreach (KeyValuePair<TKey1, TValue> kvp in Dictionary1)
{
if (kvp.Value.Equals(value))
{
Dictionary1.Remove(kvp.Key);
return true;
}
}
}
return false;
}
finally { rwLock.ExitWriteLock(); }
}
public void Clear()
{
bool gotLock = false;
rwLock.EnterWriteLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterWriteLock();
gotLock = true;
Dictionary1.Clear();
Dictionary2.Clear();
m_array = null;
}
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
Dictionary1.Clear();
Dictionary2.Clear();
m_array = null;
}
finally { rwLock.ExitWriteLock(); }
}
public int Count
@@ -247,68 +216,42 @@ namespace OpenSim.Framework
public bool ContainsKey(TKey1 key)
{
return Dictionary1.ContainsKey(key);
rwLock.EnterReadLock();
try
{
return Dictionary1.ContainsKey(key);
}
finally { rwLock.ExitReadLock(); }
}
public bool ContainsKey(TKey2 key)
{
return Dictionary2.ContainsKey(key);
rwLock.EnterReadLock();
try
{
return Dictionary2.ContainsKey(key);
}
finally { rwLock.ExitReadLock(); }
}
public bool TryGetValue(TKey1 key, out TValue value)
{
bool success;
bool gotLock = false;
rwLock.EnterReadLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterReadLock();
gotLock = true;
}
success = Dictionary1.TryGetValue(key, out value);
return Dictionary1.TryGetValue(key, out value);
}
finally
{
if (gotLock)
rwLock.ExitReadLock();
}
return success;
finally { rwLock.ExitReadLock(); }
}
public bool TryGetValue(TKey2 key, out TValue value)
{
bool success;
bool gotLock = false;
rwLock.EnterReadLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterReadLock();
gotLock = true;
}
success = Dictionary2.TryGetValue(key, out value);
return Dictionary2.TryGetValue(key, out value);
}
finally
{
if (gotLock)
rwLock.ExitReadLock();
}
return success;
finally { rwLock.ExitReadLock(); }
}
public void ForEach(Action<TValue> action)
@@ -323,76 +266,44 @@ namespace OpenSim.Framework
public void ForEach(Action<KeyValuePair<TKey1, TValue>> action)
{
bool gotLock = false;
rwLock.EnterReadLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterReadLock();
gotLock = true;
}
foreach (KeyValuePair<TKey1, TValue> entry in Dictionary1)
action(entry);
}
finally
{
if (gotLock)
rwLock.ExitReadLock();
}
finally { rwLock.ExitReadLock(); }
}
public void ForEach(Action<KeyValuePair<TKey2, TValue>> action)
{
bool gotLock = false;
rwLock.EnterReadLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterReadLock();
gotLock = true;
}
foreach (KeyValuePair<TKey2, TValue> entry in Dictionary2)
action(entry);
}
finally
{
if (gotLock)
rwLock.ExitReadLock();
}
finally { rwLock.ExitReadLock(); }
}
public TValue FindValue(Predicate<TValue> predicate)
{
TValue[] values = GetArray();
int len = values.Length;
for (int i = 0; i < len; ++i)
for (int i = 0; i < values.Length; ++i)
{
if (predicate(values[i]))
return values[i];
}
return default(TValue);
return default;
}
public IList<TValue> FindAll(Predicate<TValue> predicate)
{
IList<TValue> list = new List<TValue>();
IList<TValue> list = [];
TValue[] values = GetArray();
int len = values.Length;
for (int i = 0; i < len; ++i)
for (int i = 0; i < values.Length; ++i)
{
if (predicate(values[i]))
list.Add(values[i]);
@@ -402,21 +313,11 @@ namespace OpenSim.Framework
public int RemoveAll(Predicate<TValue> predicate)
{
IList<TKey1> list = new List<TKey1>();
bool gotUpgradeableLock = false;
IList<TKey1> list = [];
rwLock.EnterUpgradeableReadLock();
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
rwLock.EnterUpgradeableReadLock();
gotUpgradeableLock = true;
}
foreach (KeyValuePair<TKey1, TValue> kvp in Dictionary1)
{
if (predicate(kvp.Value))
@@ -430,83 +331,43 @@ namespace OpenSim.Framework
list2.Add(kvp.Key);
}
bool gotWriteLock = false;
try
{
try {}
finally
{
rwLock.EnterWriteLock();
gotWriteLock = true;
rwLock.EnterWriteLock();
for (int i = 0; i < list.Count; i++)
Dictionary1.Remove(list[i]);
for (int i = 0; i < list.Count; i++)
Dictionary1.Remove(list[i]);
for (int i = 0; i < list2.Count; i++)
Dictionary2.Remove(list2[i]);
m_array = null;
}
}
finally
{
if (gotWriteLock)
rwLock.ExitWriteLock();
for (int i = 0; i < list2.Count; i++)
Dictionary2.Remove(list2[i]);
m_array = null;
return list.Count;
}
finally { rwLock.ExitWriteLock(); }
}
finally
{
if (gotUpgradeableLock)
rwLock.ExitUpgradeableReadLock();
}
finally { rwLock.ExitUpgradeableReadLock(); }
return list.Count;
}
public TValue[] GetArray()
{
bool gotupLock = false;
rwLock.EnterUpgradeableReadLock();
try
{
try { }
finally
{
rwLock.EnterUpgradeableReadLock();
gotupLock = true;
}
if (m_array == null)
{
bool gotwritelock = false;
rwLock.EnterWriteLock();
try
{
try { }
finally
{
rwLock.EnterWriteLock();
gotwritelock = true;
}
m_array = new TValue[Dictionary1.Count];
Dictionary1.Values.CopyTo(m_array, 0);
}
finally
{
if (gotwritelock)
rwLock.ExitWriteLock();
}
finally { rwLock.ExitWriteLock(); }
}
return m_array;
}
catch
{
return new TValue[0];
}
finally
{
if (gotupLock)
rwLock.ExitUpgradeableReadLock();
}
catch { return []; }
finally { rwLock.ExitUpgradeableReadLock(); }
}
}
}

View File

@@ -39,8 +39,7 @@ namespace OpenSim.Region.Framework.Scenes
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase> m_entities
= new DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase>();
private readonly DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase> m_entities= new();
public int Count
{

View File

@@ -92,18 +92,23 @@ namespace OpenSim.Region.Framework.Scenes
private static SceneManager m_instance = null;
public static SceneManager Instance
{
get {
if (m_instance == null)
m_instance = new SceneManager();
get
{
m_instance ??= new SceneManager();
return m_instance;
}
}
private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>();
private readonly DoubleDictionaryThreadAbortSafe<UUID, string, Scene> m_localScenes = new();
public List<Scene> Scenes
{
get { return new List<Scene>(m_localScenes.FindAll(delegate(Scene s) { return true; })); }
get { return [.. m_localScenes.GetArray()]; }
}
public Scene[] GetScenes()
{
return m_localScenes.GetArray();
}
/// <summary>
@@ -120,10 +125,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if (CurrentScene == null)
{
List<Scene> sceneList = Scenes;
if (sceneList.Count == 0)
return null;
return sceneList[0];
ReadOnlySpan<Scene> sceneList = GetScenes();
return sceneList.Length > 0 ? sceneList[0] : null;
}
else
{
@@ -135,19 +138,13 @@ namespace OpenSim.Region.Framework.Scenes
public SceneManager()
{
m_instance = this;
m_localScenes = new DoubleDictionary<UUID, string, Scene>();
m_localScenes = new DoubleDictionaryThreadAbortSafe<UUID, string, Scene>();
}
public void Close()
{
List<Scene> localScenes = null;
lock (m_localScenes)
{
localScenes = Scenes;
}
for (int i = 0; i < localScenes.Count; i++)
Scene[] localScenes = GetScenes();
for(int i = 0; i < localScenes.Length; i++)
{
localScenes[i].Close();
}
@@ -175,8 +172,7 @@ namespace OpenSim.Region.Framework.Scenes
lock (m_localScenes)
{
m_localScenes.TryGetValue(rdata.RegionID, out restartedScene);
m_localScenes.Remove(rdata.RegionID);
m_localScenes.Remove(rdata.RegionID, out restartedScene);
}
// If the currently selected scene has been restarted, then we can't reselect here since we the scene
@@ -205,9 +201,9 @@ namespace OpenSim.Region.Framework.Scenes
if (s != null)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
for (int i = 0; i < sceneList.Count; i++)
for (int i = 0; i < sceneList.Length; i++)
{
if (sceneList[i]!= s)
{
@@ -229,8 +225,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SaveCurrentSceneToXml(string filename)
{
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
if (serialiser != null)
serialiser.SavePrimsToXml(CurrentOrFirstScene, filename);
serialiser?.SavePrimsToXml(CurrentOrFirstScene, filename);
}
/// <summary>
@@ -242,8 +237,7 @@ namespace OpenSim.Region.Framework.Scenes
public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, Vector3 loadOffset)
{
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
if (serialiser != null)
serialiser.LoadPrimsFromXml(CurrentOrFirstScene, filename, generateNewIDs, loadOffset);
serialiser?.LoadPrimsFromXml(CurrentOrFirstScene, filename, generateNewIDs, loadOffset);
}
/// <summary>
@@ -253,15 +247,13 @@ namespace OpenSim.Region.Framework.Scenes
public void SaveCurrentSceneToXml2(string filename)
{
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
if (serialiser != null)
serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename);
serialiser?.SavePrimsToXml2(CurrentOrFirstScene, filename);
}
public void SaveNamedPrimsToXml2(string primName, string filename)
{
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
if (serialiser != null)
serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
serialiser?.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
}
/// <summary>
@@ -270,8 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
public void LoadCurrentSceneFromXml2(string filename)
{
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
if (serialiser != null)
serialiser.LoadPrimsFromXml2(CurrentOrFirstScene, filename);
serialiser?.LoadPrimsFromXml2(CurrentOrFirstScene, filename);
}
/// <summary>
@@ -282,8 +273,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SaveCurrentSceneToArchive(string[] cmdparams)
{
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams);
archiver?.HandleSaveOarConsoleCommand(string.Empty, cmdparams);
}
/// <summary>
@@ -294,8 +284,7 @@ namespace OpenSim.Region.Framework.Scenes
public void LoadArchiveToCurrentScene(string[] cmdparams)
{
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams);
archiver?.HandleLoadOarConsoleCommand(string.Empty, cmdparams);
}
public string SaveCurrentSceneMapToXmlString()
@@ -338,18 +327,16 @@ namespace OpenSim.Region.Framework.Scenes
public bool TrySetCurrentScene(string regionName)
{
if ((String.Compare(regionName, "root") == 0)
|| (String.Compare(regionName, "..") == 0)
|| (String.Compare(regionName, "/") == 0))
if ((string.Compare(regionName, "root") == 0)
|| (string.Compare(regionName, "..") == 0)
|| (string.Compare(regionName, "/") == 0))
{
CurrentScene = null;
return true;
}
else
{
Scene s;
if (m_localScenes.TryGetValue(regionName, out s))
if (m_localScenes.TryGetValue(regionName, out Scene s))
{
CurrentScene = s;
return true;
@@ -386,7 +373,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetScene(uint locX, uint locY, out Scene scene)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene mscene in sceneList)
{
if (mscene.RegionInfo.RegionLocX == locX &&
@@ -403,7 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene mscene in sceneList)
{
if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
@@ -420,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes
public List<ScenePresence> GetCurrentSceneAvatars()
{
List<ScenePresence> avatars = new List<ScenePresence>();
List<ScenePresence> avatars = [];
ForEachSelectedScene(
delegate(Scene scene)
@@ -437,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
public List<ScenePresence> GetCurrentScenePresences()
{
List<ScenePresence> presences = new List<ScenePresence>();
List<ScenePresence> presences = [];
ForEachSelectedScene(delegate(Scene scene)
{
@@ -452,13 +439,7 @@ namespace OpenSim.Region.Framework.Scenes
public RegionInfo GetRegionInfo(UUID regionID)
{
Scene s;
if (m_localScenes.TryGetValue(regionID, out s))
{
return s.RegionInfo;
}
return null;
return m_localScenes.TryGetValue(regionID, out Scene s) ? s.RegionInfo : null;
}
public void ForceCurrentSceneClientUpdate()
@@ -473,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene scene in sceneList)
{
if (scene.TryGetScenePresence(avatarId, out avatar))
@@ -488,7 +469,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetRootScenePresence(UUID avatarId, out ScenePresence avatar)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene scene in sceneList)
{
if (scene.TryGetSceneRootPresence(avatarId, out avatar))
@@ -509,7 +490,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene scene in sceneList)
{
if (scene.TryGetAvatarByName(avatarName, out avatar))
@@ -524,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetRootScenePresenceByName(string firstName, string lastName, out ScenePresence sp)
{
List<Scene> sceneList = Scenes;
Scene[] sceneList = GetScenes();
foreach (Scene scene in sceneList)
{
sp = scene.GetScenePresence(firstName, lastName);
@@ -538,8 +519,9 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachScene(Action<Scene> action)
{
List<Scene> sceneList = Scenes;
sceneList.ForEach(action);
Scene[] sceneList = GetScenes();
foreach(Scene s in sceneList)
action(s);
}
}
}