<commit_before>//
//  DispatchClosure.swift
//  THGDispatch
//
//  Created by <NAME> on 2/15/15.
//  Copyright (c) 2015 TheHolyGrail. All rights reserved.
//

import Foundation

public struct DispatchClosure {
    
    public init(_ closure: () -> Void) {
        rawObject = dispatch_block_create(DISPATCH_BLOCK_INHERIT_QOS_CLASS) {
            autoreleasepool(closure)
        }
    }
    
    public func notify(queue: DispatchQueue, closure: () -> Void) -> DispatchClosure {
        let wrappedClosure = DispatchClosure(closure)
        dispatch_block_notify(rawObject, queue.dispatchQueue(), wrappedClosure.rawObject)
        
        return wrappedClosure
    }
    
    public func wait() {
        dispatch_block_wait(rawObject, DISPATCH_TIME_FOREVER)
    }
    
    public func wait(timeout: NSTimeInterval) -> Bool {
        let dispatchTimeout = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSTimeInterval(NSEC_PER_SEC)))
        
        // result == 1 if it was a success, 0 if it timed out.
        let result = dispatch_block_wait(rawObject, dispatchTimeout)
        return result == 0
    }
    
    public func closure() -> dispatch_block_t {
        return rawObject
    }
    
    private let rawObject: dispatch_block_t
}<commit_msg>Made naming of the raw object more consistent.<commit_after>//
//  DispatchClosure.swift
//  THGDispatch
//
//  Created by <NAME> on 2/15/15.
//  Copyright (c) 2015 TheHolyGrail. All rights reserved.
//

import Foundation

public struct DispatchClosure {
    
    public init(_ closure: () -> Void) {
        rawObject = dispatch_block_create(DISPATCH_BLOCK_INHERIT_QOS_CLASS) {
            autoreleasepool(closure)
        }
    }
    
    public func notify(queue: DispatchQueue, closure: () -> Void) -> DispatchClosure {
        let wrappedClosure = DispatchClosure(closure)
        dispatch_block_notify(rawObject, queue.dispatchQueue(), wrappedClosure.rawObject)
        
        return wrappedClosure
    }
    
    public func wait() {
        dispatch_block_wait(rawObject, DISPATCH_TIME_FOREVER)
    }
    
    public func wait(timeout: NSTimeInterval) -> Bool {
        let dispatchTimeout = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSTimeInterval(NSEC_PER_SEC)))
        
        // result == 1 if it was a success, 0 if it timed out.
        let result = dispatch_block_wait(rawObject, dispatchTimeout)
        return result == 0
    }
    
    public func dispatchClosure() -> dispatch_block_t {
        return rawObject
    }
    
    private let rawObject: dispatch_block_t
}
{'fraction_non_alphanumeric': 0.08727984344422701, 'fraction_numerical': 0.010958904109589041, 'mean_word_length': 2.625531914893617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '7037361', 'n_tokens_mistral': 811, 'n_tokens_neox': 752, 'n_words': 179}