• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemoBytom / DemoEngine / 24608431965

18 Apr 2026 03:59PM UTC coverage: 30.6% (+0.1%) from 30.483%
24608431965

push

coveralls.net

DemoBytom
Fix unit test hanging indefinitely.

Added explicit timeout.
Fixed the test to setup correct `BlockingDoEvents` method instad `DoEvents`

1291 of 4219 relevant lines covered (30.6%)

0.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Demo.Engine.Core/Features/StaThread/StaThreadWriter.cs
1
// Copyright © Michał Dembski and contributors.
2
// Distributed under MIT license. See LICENSE file in the root for more information.
3

4
using System.Threading.Channels;
5
using Demo.Engine.Core.ValueObjects;
6
using Microsoft.Extensions.ObjectPool;
7

8
namespace Demo.Engine.Core.Features.StaThread;
9

10
internal sealed class StaThreadWriter(
×
11
    ChannelWriter<StaThreadRequests> channelWriter,
×
12
    ObjectPool<StaThreadRequests.DoEventsOkRequest> doEventsOkPool)
×
13
    : IStaThreadWriter,
14
      IDisposable
15
{
16
    private readonly ChannelWriter<StaThreadRequests> _channelWriter = channelWriter;
×
17
    private readonly ObjectPool<StaThreadRequests.DoEventsOkRequest> _doEventsOkPool = doEventsOkPool;
×
18
    private bool _disposedValue;
19

20
    public async Task<RenderingSurfaceId> CreateSurface(
21
        CancellationToken cancellationToken = default)
22
    {
23
        var createSurfaceRequest = StaThreadRequests.CreateSurface();
×
24
        await _channelWriter.WriteAsync(
×
25
                createSurfaceRequest,
×
26
                cancellationToken);
×
27

28
        return await createSurfaceRequest.Invoked;
×
29
    }
×
30

31
    public async ValueTask<bool> DoEventsOk(
32
        RenderingSurfaceId renderingSurfaceId,
33
        CancellationToken cancellationToken = default)
34
    {
35
        var request = _doEventsOkPool.Get();
×
36

37
        try
38
        {
39
            request.Reset(renderingSurfaceId, blockingCall: false, cancellationToken);
×
40

41
            await _channelWriter.WriteAsync(
×
42
                request,
×
43
                cancellationToken);
×
44

45
            return await request.Invoked;
×
46
        }
47
        finally
48
        {
49
            _doEventsOkPool.Return(request);
×
50
        }
51
    }
×
52

53
    public async ValueTask<bool> BlockingDoEventsOk(
54
        RenderingSurfaceId renderingSurfaceId,
55
        CancellationToken cancellationToken = default)
56
    {
57
        var request = _doEventsOkPool.Get();
×
58

59
        try
60
        {
61
            request.Reset(renderingSurfaceId, blockingCall: true, cancellationToken);
×
62

63
            await _channelWriter.WriteAsync(
×
64
                request,
×
65
                cancellationToken);
×
66

67
            return await request.Invoked;
×
68
        }
69
        finally
70
        {
71
            _doEventsOkPool.Return(request);
×
72
        }
73
    }
×
74

75
    private void Dispose(bool disposing)
76
    {
77
        if (!_disposedValue)
×
78
        {
79
            if (disposing)
×
80
            {
81
                _channelWriter.Complete();
×
82
            }
83

84
            _disposedValue = true;
×
85
        }
86
    }
×
87

88
    public void Dispose()
89
    {
90
        // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
91
        Dispose(disposing: true);
×
92
        GC.SuppressFinalize(this);
×
93
    }
×
94
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc