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

XInitThreads #15

Closed
ctrueden opened this issue Feb 1, 2024 · 5 comments
Closed

XInitThreads #15

ctrueden opened this issue Feb 1, 2024 · 5 comments
Labels

Comments

@ctrueden
Copy link
Member

ctrueden commented Feb 1, 2024

The ImageJ Launcher calls XInitThreads on Linux when not in headless mode, so that 3D graphics libraries like Vulkan work as needed:

#ifdef __linux__
  void (*xinit_threads_reference)();
  ...
  // This call is neccessary on Linux to avoid X11 errors when using
  // various 3D graphics APIs like Vulkan or OpenGL.
  if (!headless) {
    void *libX11Handle = dlopen("libX11.so", RTLD_LAZY);
    if(libX11Handle != NULL) {
      debug("Running XInitThreads\n");
      xinit_threads_reference = dlsym(libX11Handle, "XInitThreads");

      if(xinit_threads_reference != NULL) {
        xinit_threads_reference();
      } else {
        error("Could not find XInitThreads in X11 library: %s\n", dlerror());
      }
    } else {
      error("Could not find X11 library, not running XInitThreads.\n");
    }
  }
#endif

Should Jaunch also do this? Maybe an optional directive? It would be a directive that does not switch the result from LAUNCH to CANCEL.

@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/jaunch-a-new-java-launcher-test-fiji-with-java-21/92058/1

@kephale
Copy link

kephale commented Feb 23, 2024

Is there a reason not to run XInitThreads?

@ctrueden
Copy link
Member Author

@kephale Not that I know of. But I know next to nothing about XInitThreads. Why is this even necessary in the first place? What impact does it have to run or not run it? I have no idea.

@kephale
Copy link

kephale commented Mar 11, 2024

Yeah, all I know is that you get race conditions if you don't run it. sciview is still being haunted by whatever race conditions are happening on Linux, which can't be just XInitThreads...

@skalarproduktraum
Copy link
Contributor

#44 brings this one step closer 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants