Created
September 22, 2014 15:27
-
-
Save longshorej/c7f1b5195b069d18130f to your computer and use it in GitHub Desktop.
scala repl threads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def threaded(numThreads: Int)(block: => Unit) = { | |
val threads = for (n <- 1 to numThreads) yield new Thread(new Runnable { | |
def run() = block | |
}) | |
threads foreach (_.start()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment