-
Notifications
You must be signed in to change notification settings - Fork 15
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
Added multithreaded lock test. #73
base: master
Are you sure you want to change the base?
Conversation
This should detect issues with uneven locking and releasing.
Now fails on:
|
@tommikas could you check this out |
A bit worried that https://github.com/ARMmbed/mbed-trace/blob/master/test/Test.cpp#L31-L38 wait and releases are just counters and not real locks. |
The missing mutexes is going to be an issue, if this test is taken to use some modifications need to be done for the test mutexes. |
Off the top of my head I'm guessing that there are interleaved calls from more than one thread. When the first one exits the trace call it rolls back all the "mutex calls" from both threads. This shouldn't happen with a real mutex.
Yeah, with multiple threads it needs a real mutex. Should be no problem just initializing one and adding the calls to the wait and release functions. The counters should still work. The original test just ensured that for all the tested calls the library releases the mutex as many times as it locks it. |
@korjaa Even if the original problem has been resolved it wouldn't hurt to have this kind of test in. Would you mind adding the mutex to the wait and release functions? |
"Off the top of my head I'm guessing..." "...to have this kind of test in" |
A deadlock shouldn't be too hard to catch. Use a "ready to join" flag for each thread to know when to call |
Awesome, you already seem to have an idea how to solve this ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks amazing
This should detect issues with uneven locking and releasing.
Test flow: