<commit_before>package org.reactress
package isolate



import scala.annotation._
import scala.collection._



trait EventQueue[@spec(Int, Long, Double) Q]
extends Enqueuer[Q] {
  def foreach[@spec(Int, Long, Double) T](f: IsolateFrame[T, Q])(implicit scheduler: Scheduler): Dequeuer[Q]
  def isEmpty: Boolean
  def nonEmpty = !isEmpty
}


object EventQueue {

  class SingleSubscriberSyncedUnrolledRing[@spec(Int, Long, Double) Q: Arrayable](val monitor: util.Monitor)
  extends EventQueue[Q] {
    private[reactress] val ring = new util.UnrolledRing[Q]

    private[reactress] var listener: IsolateFrame[_, Q] = _

    def +=(elem: Q) = {
      val l = monitor.synchronized {
        ring.enqueue(elem)
        listener
      }
      wakeAll(l)
    }

    private def wakeAll(frame: IsolateFrame[T, Q]): Unit = {
      frame.wake()
    }

    def foreach[@spec(Int, Long, Double) T](f: IsolateFrame[T, Q])(implicit scheduler: Scheduler) = monitor.synchronized {
      val dequeuer = new SingleSubscriberSyncedUnrolledRingDequeuer(this)
      listener = f
      dequeuer
    }

    def isEmpty = monitor.synchronized { ring.isEmpty }

    def dequeue(): Q = monitor.synchronized {
      ring.dequeue()
    }

    def enqueueIfEmpty(v: Q) = monitor.synchronized {
      if (ring.isEmpty) ring.enqueue(v)
    }
  }

  class SingleSubscriberSyncedUnrolledRingDequeuer[@spec(Int, Long, Double) Q]
    (q: SingleSubscriberSyncedUnrolledRing[Q])
  extends Dequeuer[Q] {
    def dequeue() = q.dequeue()
    def isEmpty = q.isEmpty
  }

}
<commit_msg>Fix erroneous type in event queues.<commit_after>package org.reactress
package isolate



import scala.annotation._
import scala.collection._



trait EventQueue[@spec(Int, Long, Double) Q]
extends Enqueuer[Q] {
  def foreach[@spec(Int, Long, Double) T](f: IsolateFrame[T, Q])(implicit scheduler: Scheduler): Dequeuer[Q]
  def isEmpty: Boolean
  def nonEmpty = !isEmpty
}


object EventQueue {

  class SingleSubscriberSyncedUnrolledRing[@spec(Int, Long, Double) Q: Arrayable](val monitor: util.Monitor)
  extends EventQueue[Q] {
    private[reactress] val ring = new util.UnrolledRing[Q]

    private[reactress] var listener: IsolateFrame[_, Q] = _

    def +=(elem: Q) = {
      val l = monitor.synchronized {
        ring.enqueue(elem)
        listener
      }
      wakeAll(l)
    }

    private def wakeAll(frame: IsolateFrame[_, Q]): Unit = {
      frame.wake()
    }

    def foreach[@spec(Int, Long, Double) T](f: IsolateFrame[T, Q])(implicit scheduler: Scheduler) = monitor.synchronized {
      val dequeuer = new SingleSubscriberSyncedUnrolledRingDequeuer(this)
      listener = f
      dequeuer
    }

    def isEmpty = monitor.synchronized { ring.isEmpty }

    def dequeue(): Q = monitor.synchronized {
      ring.dequeue()
    }

    def enqueueIfEmpty(v: Q) = monitor.synchronized {
      if (ring.isEmpty) ring.enqueue(v)
    }
  }

  class SingleSubscriberSyncedUnrolledRingDequeuer[@spec(Int, Long, Double) Q]
    (q: SingleSubscriberSyncedUnrolledRing[Q])
  extends Dequeuer[Q] {
    def dequeue() = q.dequeue()
    def isEmpty = q.isEmpty
  }

}

{'fraction_non_alphanumeric': 0.11032138442521632, 'fraction_numerical': 0.0, 'mean_word_length': 2.9427527405602922, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4887976', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1048, 'n_words': 239}