Is it safe to run Revise from multiple threads? It seems that Revise in typical usage, e.g. a REPL session, will only run in the interactive thread, and then the updated code will end up run in existing threads, assuming invokelatest is used.
Looking around the Revise codebase, I’m not seeing many locks.
What can happen if a Revise is started in multiple workers threads:
Can the compiler perform unsafe overlapping/non-atomic accesses/writes (I guess/hope not)
Can Revise do the same to its own internal tracking structures? (it appears so to me)
What about the thundering heard effect? If I run Revise in multiple worker threads will they end up duplicating work? (seems to almost definitely be the case)
This doesn’t directly address your question, but I believe it is safe to call revise once (from any thread) even while other threads are running in the background. The other threads won’t pick up any changes unless they use invokelatest or invoke in the new world number.
That’s somewhat orthogonal from actually revising code using multiple threads though.