Skip to content
New issue

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

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

Already on GitHub? # to your account

OpenCLProbeLibrary.isValid() can fail if called before static block in JavaCL is executed #40

Open
jxb532 opened this issue Apr 12, 2019 · 0 comments

Comments

@jxb532
Copy link

jxb532 commented Apr 12, 2019

Between version 1.0.0-RC2 and 1.0.0-RC4 the following lines were moved from the static block in OpenCLProbeLibrary to the static block in JavaCL:

BridJ.setNativeLibraryActualName("OpenCLProbe", "OpenCL");
BridJ.register();

In RC4 it's possible to call OpenCLProbeLibrary.isValid() before the static block is executed in JavaCL, meaning the call to isValid() will fail. Nothing in isValid() guarantees the initialization of JavaCL.

Can be reproduced by:

public class IsValidTest {
	public static void main(String[] args) {
		OpenCLProbeLibrary.isValid(); // Returns false
	}
}
public class IsValidTest {
	public static void main(String[] args) {
		new JavaCL(); // Force the static initialization of JavaCL
		OpenCLProbeLibrary.isValid(); // Returns true
	}
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant