aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2021-04-30 15:09:36 +0200
committercvium <clausvium@gmail.com>2021-04-30 15:09:36 +0200
commit608cba817c54df60959079719bafca4d7d54269a (patch)
treedb024902a82c5ec64ffc88c0827d4f891cf45983 /Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
parenteeb5d4bd1e63ad89f599fd52a79b3c80ed8f8ad1 (diff)
Reduce some allocations with the magic of spans etc.
Diffstat (limited to 'Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs')
-rw-r--r--Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
index 315277985..72c0a838e 100644
--- a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
+++ b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs
@@ -269,14 +269,17 @@ namespace Emby.Server.Implementations.SyncPlay
var user = _userManager.GetUserById(session.UserId);
List<GroupInfoDto> list = new List<GroupInfoDto>();
- foreach (var group in _groups.Values)
+ lock (_groupsLock)
{
- // Locking required as group is not thread-safe.
- lock (group)
+ foreach (var (_, group) in _groups)
{
- if (group.HasAccessToPlayQueue(user))
+ // Locking required as group is not thread-safe.
+ lock (group)
{
- list.Add(group.GetInfo());
+ if (group.HasAccessToPlayQueue(user))
+ {
+ list.Add(group.GetInfo());
+ }
}
}
}