Skip to content

Instantly share code, notes, and snippets.

import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.atomic.AtomicInteger
object Hotpotato {
private val nwaiters = new AtomicInteger(0)
private val executionQueue = new LinkedBlockingQueue[Function0[Unit]]
def serialized(f: => Unit) {
executionQueue offer { () => f }