Every time a thread enters a function, check whether other threads should still wait...