<commit_before>//
//  Mutex.swift
//  Interstellar
//
//  Created by <NAME> on 14/04/16.
//  Copyright © 2016 nerdgeschoss GmbH. All rights reserved.
//

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin
#endif

internal class Mutex {
    fileprivate var mutex = pthread_mutex_t()
    
    init() {
        pthread_mutex_init(&mutex, nil)
    }
    
    deinit {
        pthread_mutex_destroy(&mutex)
    }
    
    func lock() -> Int32 {
        return pthread_mutex_lock(&mutex)
    }
    
    @discardableResult func unlock() -> Int32 {
        return pthread_mutex_unlock(&mutex)
    }
    
    func lock(_ closure: () -> Void) {
        let status = lock()
        assert(status == 0, "pthread_mutex_lock: \(strerror(status))")
        defer { unlock() }
        closure()
    }
}<commit_msg>Silenced warning on Xcode 10. (#67)<commit_after>//
//  Mutex.swift
//  Interstellar
//
//  Created by <NAME> on 14/04/16.
//  Copyright © 2016 nerdgeschoss GmbH. All rights reserved.
//

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin
#endif

internal class Mutex {
    fileprivate var mutex = pthread_mutex_t()
    
    init() {
        pthread_mutex_init(&mutex, nil)
    }
    
    deinit {
        pthread_mutex_destroy(&mutex)
    }
    
    func lock() -> Int32 {
        return pthread_mutex_lock(&mutex)
    }
    
    @discardableResult func unlock() -> Int32 {
        return pthread_mutex_unlock(&mutex)
    }
    
    func lock(_ closure: () -> Void) {
        let status = lock()
        assert(status == 0, "pthread_mutex_lock: \(String(describing: strerror(status)))")
        defer { unlock() }
        closure()
    }
}
{'fraction_non_alphanumeric': 0.12187871581450654, 'fraction_numerical': 0.020214030915576695, 'mean_word_length': 2.1875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4417670', 'n_tokens_mistral': 589, 'n_tokens_neox': 547, 'n_words': 132}