Skip to content

Commit 142c0ae

Browse files
committed
Add lockguard on execute
1 parent 0eb70d3 commit 142c0ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

native/src/io_pdal_Pipeline.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <stdio.h>
3535
#include <iostream>
3636
#include <string>
37+
#include <mutex>
3738

3839
#include "io_pdal_Pipeline.h"
3940
#include "JavaPipeline.hpp"
@@ -49,6 +50,8 @@ using pdal::PointViewLess;
4950
using pdal::PointViewPtr;
5051
using pdal::pdal_error;
5152

53+
std::mutex execute_mutex;
54+
5255
jstring throwInitializationException(JNIEnv *env, const char *message)
5356
{
5457
jclass Exception = env->FindClass("io/pdal/InitializationException");
@@ -101,6 +104,7 @@ JNIEXPORT void JNICALL Java_io_pdal_Pipeline_execute
101104
Pipeline *p = getHandle<Pipeline>(env, obj);
102105
try
103106
{
107+
std::lock_guard<std::mutex> lock (execute_mutex);
104108
p->execute();
105109
}
106110
catch(const pdal_error &pe)

0 commit comments

Comments
 (0)