I am reviewing a code and feel that there is a race conditioin. Just want to understand what exactly is the problem and how to fix it in C++.
This is a C++ code that supposed to compile in a Linux environment.
if ((m_maxSessions != -1) && ((m_numSessions + 1) > m_maxSessions)) {
CleanupRemoveSession();
} else {
InitSession();
}
I think that there could be a race condition in (m_numSessions + 1) > m_maxSessions). I was trying to solve it with an atomic variable but don't seem understand fully how it would be possible to do.
Aucun commentaire:
Enregistrer un commentaire