As soon as
太郎は「ご馳走様」と言い終わるか終わらないかのうちに、席を立って自分の部屋に入った。As soon as Taro finished saying "I'm full", he left his seat and went back to his room.
息子は夕飯を食べ終わるか終わらないかのうちに、またゲームを始めた。As soon as the son finished his dinner, he started playing games.
電車に乗るか乗らないかのうちに、ドアが閉まってしまった。As soon as I got on the tram, the door closed.
The two actions occur almost simultaneously, and include the meaning of "the previous action has not even been completed, the next action has occurred".