summaryrefslogblamecommitdiff
path: root/src/library/scala/concurrent/TaskRunner.scala
blob: e9b7c6916b172dc32edf682f135c03c9028f3b49 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                        
                  
 
              
 
                                                       
 
                                     
 
                      
 

                                                                          
     

                                                               
 
package scala.concurrent

/** The <code>TaskRunner</code> trait...
 *
 *  @author Philipp Haller
 */
trait TaskRunner {

  type Task[T]

  implicit def functionAsTask[S](fun: () => S): Task[S]

  def execute[S](task: Task[S]): Unit

  def shutdown(): Unit

  /** If expression computed successfully return it in <code>Right</code>,
   *  otherwise return exception in <code>Left</code>.
   */
  protected def tryCatch[A](body: => A): Either[Exception, A] =
    ops tryCatchEx body
}