This was non-obvious to me since I have experience with V8 which takes care of synchronization for you.
Before setting a context, you might need to unset the current one. Which is what your ContextGuard does as it is dropped. Except it doesn't prevent another thread from trying to set the same context concurrently.
I was thinking an Arc<Mutex<()>> might work for entering a context.
I'm not sure what's the logic with setting the "previous" context as the current context from the Context#exit method. I'm assuming people won't be using more than 1 context per runtime, so inner guards are probably infrequent.
Any ideas?