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) + } }