Currently, Neon pessimistically assumes that JavaScript runtimes may choose to execute from different threads. The specification only defines serial execution and not necessarily single threaded execution.
In practice, this will always be one thread. V8 makes heavy usage of TLS and it would be a large lift to start doing things differently.
This PR changes Neon to optimistically assume the runtime will always execute from the same thread. As a small level of protection, I added SendWrapper when debug_assertions are enabled. This will panic if the single-thread invariant is violated.
Currently, Neon pessimistically assumes that JavaScript runtimes may choose to execute from different threads. The specification only defines serial execution and not necessarily single threaded execution.
In practice, this will always be one thread. V8 makes heavy usage of TLS and it would be a large lift to start doing things differently.
This PR changes Neon to optimistically assume the runtime will always execute from the same thread. As a small level of protection, I added
SendWrapper
whendebug_assertions
are enabled. This willpanic
if the single-thread invariant is violated.