Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Added a test to verify core mutex behaviour #193

Merged
merged 2 commits into from
Jul 7, 2022

Conversation

gkc
Copy link
Contributor

@gkc gkc commented Jul 7, 2022

- What I did
Added a test to verify core mutex behaviour

- How I did it
Added a test case which asserts that appropriate use of await mutex.acquired() and mutex.release() wrapping critical sections code does indeed result in expected behaviour with critical sections executing sequentially not concurrently.

- How to verify it
Test passes

- Description for the changelog
Added a test to verify core mutex behaviour

@gkc gkc requested a review from VJag July 7, 2022 12:39
Created a new file, mutex_test.dart, and moved the new test there instead.
Copy link
Member

@VJag VJag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran it myself. LGTM.

Output:

00:00 +0: Verify mutex core behaviour

criticalSection One starting

criticalSection Two starting

criticalSection One acquired mutex

criticalSection One delaying for 100 milliseconds

criticalSection One released mutex

criticalSection Two acquired mutex

criticalSection Two delaying for 10 milliseconds

criticalSection Two released mutex

00:00 +1: All tests passed!

@gkc gkc merged commit bc77f19 into trunk Jul 7, 2022
@gkc gkc deleted the gck_test_to_verify_mutex_core_behaviour branch July 7, 2022 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants