Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some thread-safety advice to the docs #107

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ julia> Renderer.render(width = 360, height = 480, title = "IMGUI Window") do
Task (runnable) @0x00000001136bead0
```

Note that neither ImGui nor OpenGL are thread-safe, be aware of this if you
start Julia with multiple threads using `--threads`. If you need to use multiple
threads in an application, one option is to use the
[threadpools](https://docs.julialang.org/en/v1/manual/multi-threading/#man-threadpools)
introduced in Julia 1.9:
```bash
# Have an arbitrary number in the default pool, and 1 thread in the :interactive pool
$ julia --threads=auto,1
```

Then start the render loop on the `:interactive` thread and ensure that none of
the other threads call GUI functions.

## Usage
The API provided in this package is as close as possible to the original C++ API. When translating C++ code to Julia, please follow the tips below:
- Replace `ImGui::` to `CImGui.`;
Expand Down
Loading