john-chapman / im3d

Immediate mode rendering and 3d gizmos.
MIT License
1.18k stars 63 forks source link

Thread Safety/Multiple Contexts #18

Closed john-chapman closed 6 years ago

john-chapman commented 7 years ago

Question: is it acceptable to rely on application code to avoid modifying any of the thread-local contexts during the merge operation? This means application threads cannot make Im3d calls while the main thread is merging contexts. Answer yes, there's basically no other way. The application must be responsible for locking modifications to a context, and the only tools which Im3d can provide are per-thread context ptrs and context merging.

That said, applications have a few choices for how to go about making Im3d thread safe: