aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/native/fsevents.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/native/fsevents.cc b/src/main/native/fsevents.cc
index b051580ee7..22f9d98152 100644
--- a/src/main/native/fsevents.cc
+++ b/src/main/native/fsevents.cc
@@ -32,6 +32,10 @@ struct JNIEventsDiffAwareness {
// The former is called inside the FsEvents run loop and the latter
// from Java threads.
pthread_mutex_t mutex;
+
+ JNIEventsDiffAwareness() { pthread_mutex_init(&mutex, nullptr); }
+
+ ~JNIEventsDiffAwareness() { pthread_mutex_destroy(&mutex); }
};
// Callback called when an event is reported by the FSEvents API
@@ -64,7 +68,7 @@ Java_com_google_devtools_build_lib_skyframe_MacOSXFsEventsDiffAwareness_create(
JNIEnv *env, jobject fsEventsDiffAwareness, jobjectArray paths,
jdouble latency) {
// Create a FSEventStreamContext to pass around (env, fsEventsDiffAwareness)
- JNIEventsDiffAwareness *info = new JNIEventsDiffAwareness;
+ JNIEventsDiffAwareness *info = new JNIEventsDiffAwareness();
FSEventStreamContext context;
context.version = 0;