Fixes a regression from the trace invariant test refactoring in PR #4974 where allowing a branch before a thread switch when a signal arrives at the branch was not properly checked.
Tested in an Ubuntu 16.04 VM where the failure reproduced easily before.
Fixes #4982 (closed)