Skip to content

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

Description

@jxb532

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
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions