This is essentially a busy wait while holding a monitor.  And it could be quite a while until the active semaphore is returned (eg 30 minutes for TMX export).