{"action":"created","issue":{"url":"https://api.github.com/repos/ocornut/imgui/issues/586","repository_url":"https://api.github.com/repos/ocornut/imgui","labels_url":"https://api.github.com/repos/ocornut/imgui/issues/586/labels{/name}","comments_url":"https://api.github.com/repos/ocornut/imgui/issues/586/comments","events_url":"https://api.github.com/repos/ocornut/imgui/issues/586/events","html_url":"https://github.com/ocornut/imgui/issues/586","id":147904063,"number":586,"title":"Multiple instances of ImGui in the same program","user":{"login":"nsf","id":12567,"avatar_url":"https://avatars.githubusercontent.com/u/12567?v=3","gravatar_id":"","url":"https://api.github.com/users/nsf","html_url":"https://github.com/nsf","followers_url":"https://api.github.com/users/nsf/followers","following_url":"https://api.github.com/users/nsf/following{/other_user}","gists_url":"https://api.github.com/users/nsf/gists{/gist_id}","starred_url":"https://api.github.com/users/nsf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsf/subscriptions","organizations_url":"https://api.github.com/users/nsf/orgs","repos_url":"https://api.github.com/users/nsf/repos","events_url":"https://api.github.com/users/nsf/events{/privacy}","received_events_url":"https://api.github.com/users/nsf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-04-12T23:37:56Z","updated_at":"2016-04-14T21:59:26Z","closed_at":null,"body":"It's not a bug report but more like a question/discussion topic.\r\n\r\nSo, I have this engine of mine where I have a rendering thread which runs C++ code and scripting environment which runs C# code. They talk to each other via queue and triple buffers to pass rendering lists. Of course I want ImGui to be available on both sides and I can't really just lock it with a mutex, because it will block quite a lot. So what I did:\r\n\r\nConverted GImGui to a thread local variable, initialize ImGui from main thread before running mono scripts, also force creation of a font atlas via GetTexDataAsRGBA32 and... it kind of works. Mono renders stuff when it wants to, passes the contents of ImDrawData via triple buffer to the rendering thread, rendering thread renders both GUIs, its own and the one from mono scripting environment.\r\n\r\nBut I've noticed there are a few places where functions don't look reentrant, for example ImHash function has a static LUT which is initialized on first access. Perhaps there are some other places where implicit global state is used?\r\n\r\nIn general what do you think about that kind of usage (or should I say abusage :D)?\r\n"},"comment":{"url":"https://api.github.com/repos/ocornut/imgui/issues/comments/210172301","html_url":"https://github.com/ocornut/imgui/issues/586#issuecomment-210172301","issue_url":"https://api.github.com/repos/ocornut/imgui/issues/586","id":210172301,"user":{"login":"nsf","id":12567,"avatar_url":"https://avatars.githubusercontent.com/u/12567?v=3","gravatar_id":"","url":"https://api.github.com/users/nsf","html_url":"https://github.com/nsf","followers_url":"https://api.github.com/users/nsf/followers","following_url":"https://api.github.com/users/nsf/following{/other_user}","gists_url":"https://api.github.com/users/nsf/gists{/gist_id}","starred_url":"https://api.github.com/users/nsf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsf/subscriptions","organizations_url":"https://api.github.com/users/nsf/orgs","repos_url":"https://api.github.com/users/nsf/repos","events_url":"https://api.github.com/users/nsf/events{/privacy}","received_events_url":"https://api.github.com/users/nsf/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T21:59:26Z","updated_at":"2016-04-14T21:59:26Z","body":"@ocornut wrapped the second copy into a different namespace"}}