From 4e744043a35eeb77da8125308b416abcc8668263 Mon Sep 17 00:00:00 2001 From: nxtstep Date: Fri, 16 Nov 2018 17:26:52 +0100 Subject: [PATCH] Make sure mutexes are being freed accordingly --- runtime/Swift/Sources/Antlr4/misc/utils/Mutex.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/Swift/Sources/Antlr4/misc/utils/Mutex.swift b/runtime/Swift/Sources/Antlr4/misc/utils/Mutex.swift index 70c3ab9df..5be0c28a8 100644 --- a/runtime/Swift/Sources/Antlr4/misc/utils/Mutex.swift +++ b/runtime/Swift/Sources/Antlr4/misc/utils/Mutex.swift @@ -35,4 +35,8 @@ class Mutex { return try closure() } + deinit { + // free the mutex resource + pthread_mutex_destroy(&mutex) + } }