using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace LANCommander.SDK.Plugins;
///
public sealed class PluginEventBus : IPluginEventBus
{
private readonly ILogger _logger;
private readonly ConcurrentDictionary> _handlers = new();
private readonly object _lock = new();
public PluginEventBus(ILogger logger)
{
_logger = logger;
}
public IDisposable Subscribe(Func handler)
{
if (handler is null)
throw new ArgumentNullException(nameof(handler));
var list = _handlers.GetOrAdd(typeof(TEvent), _ => new List