Skip to content

Commit

Permalink
correct small thing that went over
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Mar 13, 2024
1 parent 13ae29c commit 375ebe0
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,11 @@ RandomAccessibleInterval<T> buildImgLib2FromNumpyLikeSHMA(String memoryName) {
Pointer pSharedMemory;
if (useLibRT) pSharedMemory = INSTANCE_RT.mmap(null, (int) size, PROT_READ, MAP_SHARED, shmFd, 0);
else pSharedMemory = INSTANCE_C.mmap(null, (int) size, PROT_READ, MAP_SHARED, shmFd, 0);
if (pSharedMemory == Pointer.NULL) {
CLibrary.INSTANCE.close(shmFd);
if (pSharedMemory == Pointer.NULL && useLibRT) {
INSTANCE_RT.close(shmFd);
throw new RuntimeException("Failed to map shared memory. Errmo: " + Native.getLastError());
} else if (pSharedMemory == Pointer.NULL && !useLibRT) {
INSTANCE_C.close(shmFd);
throw new RuntimeException("Failed to map shared memory. Errmo: " + Native.getLastError());
}
byte[] flat = new byte[(int) size];
Expand Down Expand Up @@ -713,8 +716,11 @@ RandomAccessibleInterval<T> createImgLib2RaiFromSharedMemoryBlock(String memoryN
Pointer pSharedMemory;
if (useLibRT) pSharedMemory = INSTANCE_RT.mmap(null, size, PROT_READ, MAP_SHARED, shmFd, 0);
else pSharedMemory = INSTANCE_C.mmap(null, size, PROT_READ, MAP_SHARED, shmFd, 0);
if (pSharedMemory == Pointer.NULL) {
CLibrary.INSTANCE.close(shmFd);
if (pSharedMemory == Pointer.NULL && useLibRT) {
INSTANCE_RT.close(shmFd);
throw new RuntimeException("Failed to map shared memory. Errmo: " + Native.getLastError());
} else if (pSharedMemory == Pointer.NULL && !useLibRT) {
INSTANCE_C.close(shmFd);
throw new RuntimeException("Failed to map shared memory. Errmo: " + Native.getLastError());
}
try {
Expand Down

0 comments on commit 375ebe0

Please sign in to comment.