File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed
snaploader/src/main/java/electrostatic4j/snaploader Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2023-2024 , The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader
2+ * Copyright (c) 2023-2025 , The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
3535import java .util .List ;
3636import java .util .concurrent .locks .ReentrantLock ;
3737import electrostatic4j .snaploader .platform .NativeDynamicLibrary ;
38+ import electrostatic4j .snaploader .throwable .UnSupportedSystemError ;
3839
3940/**
4041 * A thread-safe implementation for the NativeBinaryLoader.
@@ -56,7 +57,31 @@ public class ConcurrentNativeBinaryLoader extends NativeBinaryLoader {
5657 public ConcurrentNativeBinaryLoader (final List <NativeDynamicLibrary > registeredLibraries , final LibraryInfo libraryInfo ) {
5758 super (registeredLibraries , libraryInfo );
5859 }
59-
60+
61+ @ Override
62+ public NativeBinaryLoader initPlatformLibrary () throws UnSupportedSystemError {
63+ try {
64+ /* CRITICAL SECTION STARTS */
65+ lock .lock ();
66+ return super .initPlatformLibrary ();
67+ } finally {
68+ lock .unlock ();
69+ /* CRITICAL SECTION ENDS */
70+ }
71+ }
72+
73+ @ Override
74+ public NativeBinaryLoader loadLibrary (LoadingCriterion criterion ) throws Exception {
75+ try {
76+ /* CRITICAL SECTION STARTS */
77+ lock .lock ();
78+ return super .loadLibrary (criterion );
79+ } finally {
80+ lock .unlock ();
81+ /* CRITICAL SECTION ENDS */
82+ }
83+ }
84+
6085 @ Override
6186 protected void cleanExtractBinary (NativeDynamicLibrary library ) throws Exception {
6287 try {
You can’t perform that action at this time.
0 commit comments