-
Notifications
You must be signed in to change notification settings - Fork 59
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
Undefined behaviour in Cola2Session and Command? #144
Comments
Hi, thanks for spotting this. I think you are correct with the undefined behavior. It should not occur that the unlock will be triggered before the lock; however, you are correct that it's undefined behavior in the current version. And for the second part, yes, it would lock permanently currently, so maybe a timeout would be beneficial. |
Maybe you can use something like pull request #145 to address the first problem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From looking at the code I saw the following two things:
Could it be that the mutex of a command is locked in thread A when Cola2Session::sendTelegramAndListenForAnswer is called, and then unlocked in thread B (ASIO io service thread) when Cola2Session::processPacket is called when the answer is received? If this is the case, then this is undefined behavior.
Also what happens, when a command is sent, and no answer is received (because of some error). Is the mutex then never unlocked?
The text was updated successfully, but these errors were encountered: