INNER CODE UNIT · C#

LoopHostedService

Cysharp/LogicLooper · samples/LoopHostingApp/LoopHostedService.cs:11

    class LoopHostedService : IHostedService
    {
        private readonly ILogicLooperPool _looperPool;
        private readonly ILogger _logger;

        public LoopHostedService(ILogicLooperPool looperPool, ILogger<LoopHostedService> logger)
        {
            _looperPool = looperPool ?? throw new ArgumentNullException(nameof(looperPool));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            // Example: Register update action immediately.
            _ = _looperPool.RegisterActionAsync((in LogicLooperActionContext ctx) =>
            {
                if (ctx.CancellationToken.IsCancellationRequested)
                {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…