Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Latest commit

 

History

History
40 lines (32 loc) · 916 Bytes

Readme.md

File metadata and controls

40 lines (32 loc) · 916 Bytes

Project Mesty

Mesty is PoC of tooling that try to calculate all possible states of code that executes by multiple threads.

For example, this code:

public class SampleClass1
{
    private long _setCount;
    private readonly AutoResetEvent _notEmptyEvent = new(false);

    public void Set()
    {
        long newValue;
        newValue = Interlocked.Increment(ref _setCount);
        long tempValue = 1;
        if (newValue == tempValue)
        {
            _notEmptyEvent.Set();
        }
    }
}

can be invoked this way:

for (int i = 0; i < 3; i++)
    Task.Run(() => classInstance.Set());

3 threads will try to execute Increment method and possible results of method class for different methods:

1. 1th - 1; 2th - 2; 3th - 3
2. 1th - 1; 2th - 3; 3th - 2
3. ...

Generating all combinations allow us to proof that code has deadlocks or lead to unexpected results.