Skip to content

Commit

Permalink
Adding lock around step state machine to prevent race conditions with
Browse files Browse the repository at this point in the history
iceAgentStatus
  • Loading branch information
jdelapla committed Oct 12, 2023
1 parent 96d055e commit 2fb6f38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/source/Ice/IceAgentStateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ STATUS stepIceAgentStateMachine(PIceAgent pIceAgent)
ENTERS();
STATUS retStatus = STATUS_SUCCESS;
UINT64 oldState;
BOOL locked = FALSE;

CHK(pIceAgent != NULL, STATUS_NULL_ARG);

MUTEX_LOCK(pIceAgent->lock);
locked = TRUE;
do {
oldState = pIceAgent->iceAgentState;

Expand Down Expand Up @@ -87,6 +90,9 @@ STATUS stepIceAgentStateMachine(PIceAgent pIceAgent)
CleanUp:

CHK_LOG_ERR(retStatus);
if (locked) {
MUTEX_UNLOCK(pIceAgent->lock);
}

LEAVES();
return retStatus;
Expand Down

0 comments on commit 2fb6f38

Please sign in to comment.