<commit_before>//
//  QueuedPrint.swift
//  SwiftLint
//
//  Created by <NAME> on 2015-11-17.
//  Copyright © 2015 Realm. All rights reserved.
//

import Foundation

private let outputQueue: dispatch_queue_t = {
    let queue = dispatch_queue_create("io.realm.swiftlint.outputQueue", DISPATCH_QUEUE_SERIAL)
    dispatch_set_target_queue(queue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0))

    atexit_b {
        dispatch_barrier_sync(queue) {}
    }

    return queue
}()

/// A thread-safe version of Swift's standard print().
public func queuedPrint<T>(object: T) {
    dispatch_async(outputQueue) {
        print(object, terminator: "")
    }
}

/// A thread-safe, newline-terminated version of fputs(..., stderr).
public func queuedPrintError(string: String) {
    dispatch_async(outputQueue) {
        fputs(string + "\n", stderr)
    }
}<commit_msg>print terminating newline from queuedPrint<commit_after>//
//  QueuedPrint.swift
//  SwiftLint
//
//  Created by <NAME> on 2015-11-17.
//  Copyright © 2015 Realm. All rights reserved.
//

import Foundation

private let outputQueue: dispatch_queue_t = {
    let queue = dispatch_queue_create("io.realm.swiftlint.outputQueue", DISPATCH_QUEUE_SERIAL)
    dispatch_set_target_queue(queue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0))

    atexit_b {
        dispatch_barrier_sync(queue) {}
    }

    return queue
}()

/// A thread-safe version of Swift's standard print().
public func queuedPrint<T>(object: T) {
    dispatch_async(outputQueue) {
        print(object)
    }
}

/// A thread-safe, newline-terminated version of fputs(..., stderr).
public func queuedPrintError(string: String) {
    dispatch_async(outputQueue) {
        fputs(string + "\n", stderr)
    }
}
{'fraction_non_alphanumeric': 0.11965811965811966, 'fraction_numerical': 0.014814814814814815, 'mean_word_length': 3.51413881748072, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2555694', 'n_tokens_mistral': 617, 'n_tokens_neox': 578, 'n_words': 125}