Skip to content

Commit

Permalink
add a warning about #78
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Jan 12, 2025
1 parent da4ef3d commit 0145a34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Other registered packages extend the functionality of Gtk4.jl:
- [Gtk4Makie.jl](https://github.com/JuliaGtk/Gtk4Makie.jl): provides integration with the popular plotting package [Makie.jl](https://github.com/MakieOrg/Makie.jl), specifically its interactive, high performance GLMakie backend.

## Current status
**Note:** On Julia 1.11, Gtk4 causes the Julia REPL to freeze if Julia is started with more than one default thread and no interactive threads or with two interactive threads. This can be avoided with little-to-no performance penalty by being careful to start julia with `--threads N,1` or setting the environment variable `JULIA_NUM_THREADS = "N,1"` where N is the number of default threads to use.

For auto-generated code, Gtk4.jl relies on GObject introspection data generated on a Linux x86_64 machine, which may result in code that crashes on 32 bit computers. This mostly seems to affect obscure parts of GLib that are unlikely to be useful to Julia users, but 32 bit users should be aware of this.

Note that this package uses binaries for the GTK library and its dependencies that are built and packaged using [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl). On Linux it does **not** use the binaries that are packaged with your distribution. The build scripts for the binaries used by Gtk4.jl, including the library versions currently being used, can be found by perusing [Yggdrasil.jl](https://github.com/JuliaPackaging/Yggdrasil.jl).
Expand Down
7 changes: 7 additions & 0 deletions src/Gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ end

function __init__()
in("Gtk",[x.name for x in keys(Base.loaded_modules)]) && error("Gtk4 is incompatible with Gtk.")

if VERSION >= v"1.11" && isinteractive()
if (Threads.nthreads(:default) > 1 && Threads.nthreads(:interactive) == 0) ||
Threads.nthreads(:interactive) > 1
@warn("Gtk4 may freeze the REPL if there is more than one thread in its thread pool. Please set JULIA_NUM_THREADS to N,1 (for N default threads) and restart Julia.")
end
end

# check that GTK is compatible with what the GI generated code expects
vercheck = G_.check_version(MAJOR_VERSION,MINOR_VERSION,0)
Expand Down

0 comments on commit 0145a34

Please sign in to comment.