educative.io

Potential hang for printing ping and pong with semaphore

If exit.value is set to True after process_b returns to the beginning of the while loop, but before process_a returns to the beginning of the while loop, wouldn’t process_a exit, leaving process_b to hang waiting for sem1 to be released (incremented by 1)?