This is needed both for per-session parallelism and for allowing
multiple concurrent sessions in the same process. With the help of
atomicModifyIORef and unsafePerformIO it is also quite fast--an MVar
would most likely be slower. On a full compilation of Cabal's head
branch it was about 1-2 percent slower, but then overall compilation
times varied by about 4 percent, so I think it's worth it.