Refactor + Bugfix: Use Semaphore object instead of manually managing an integer.
Refactor + Bugfix: Use Semaphore object instead of manually managing an integer.

This makes it so there's only one codepath which calls the callback.

Also fixed an edge case with embedded source maps where the callback could
be called early.

novocaine/sourcemapped-stacktrace