Created
June 13, 2013 03:28
-
-
Save azenla/5771044 to your computer and use it in GitHub Desktop.
WorkerThread is a JPowerThread type
https://gist.github.com/kaendfinger/5756602
This file contains 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
package jpower.thread | |
class WorkerThread implements Runnable { | |
def closure | |
WorkerThread(Closure closure) { | |
this.closure = closure | |
} | |
def execute() { | |
def thread = new Thread(this) | |
thread.start() | |
return thread | |
} | |
def void run() { | |
closure.run() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment