From 970afd0ee8d69c09d90a59b90afd2149a6b211b5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 18 Dec 2011 16:38:24 +0100 Subject: Add TempJarCache usage --- src/com/jogamp/opencl/JOCLJNILibLoader.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/com') diff --git a/src/com/jogamp/opencl/JOCLJNILibLoader.java b/src/com/jogamp/opencl/JOCLJNILibLoader.java index 4ee99f1a..328c2237 100644 --- a/src/com/jogamp/opencl/JOCLJNILibLoader.java +++ b/src/com/jogamp/opencl/JOCLJNILibLoader.java @@ -28,8 +28,13 @@ package com.jogamp.opencl; +import java.security.AccessController; +import java.security.PrivilegedAction; + import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.NativeLibrary; +import com.jogamp.common.os.Platform; +import com.jogamp.common.util.cache.TempJarCache; /** @@ -43,7 +48,16 @@ class JOCLJNILibLoader extends JNILibLoaderBase { * @return Returns libOpenCL represented as NativeLibrary. */ static NativeLibrary loadOpenCL() { - loadLibrary("jocl", null, false); - return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader()); + return AccessController.doPrivileged(new PrivilegedAction() { + public NativeLibrary run() { + Platform.initSingleton(); + final String libName = "jocl"; + if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) { + addNativeJarLibs(JOCLJNILibLoader.class, "jocl", null ); + } + loadLibrary(libName, false); + return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader()); + } + }); } } -- cgit v1.2.3