<commit_before>//
//  waiter.swift
//  async-deferred
//
//  Created by <NAME> on 2015-07-13.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Dispatch

struct Waiter
{
  let block: dispatch_block_t
  var next: UnsafeMutablePointer<Waiter> = nil

  init(_ block: dispatch_block_t)
  {
    self.block = block
  }
}

enum WaitQueue
{
  static func notifyAll(queue: dispatch_queue_t, _ tail: UnsafeMutablePointer<Waiter>)
  {
    var head = reverseList(tail)
    while head != nil
    {
      let current = head
      head = head.memory.next

      dispatch_async(queue, current.memory.block)

      current.destroy()
      current.dealloc(1)
    }
  }

  static func dealloc(tail: UnsafeMutablePointer<Waiter>)
  {
    var waiter = tail<commit_msg>make Waiter.block private<commit_after>//
//  waiter.swift
//  async-deferred
//
//  Created by <NAME> on 2015-07-13.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Dispatch

struct Waiter
{
  private let block: dispatch_block_t
  var next: UnsafeMutablePointer<Waiter> = nil

  init(_ block: dispatch_block_t)
  {
    self.block = block
  }
}

enum WaitQueue
{
  static func notifyAll(queue: dispatch_queue_t, _ tail: UnsafeMutablePointer<Waiter>)
  {
    var head = reverseList(tail)
    while head != nil
    {
      let current = head
      head = head.memory.next

      dispatch_async(queue, current.memory.block)

      current.destroy()
      current.dealloc(1)
    }
  }

  static func dealloc(tail: UnsafeMutablePointer<Waiter>)
  {
    var waiter = tail
{'fraction_non_alphanumeric': 0.107421875, 'fraction_numerical': 0.016927083333333332, 'mean_word_length': 2.8521303258145365, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '7348138', 'n_tokens_mistral': 545, 'n_tokens_neox': 506, 'n_words': 124}