src/Pure/Concurrent/simple_thread.ML
author wenzelm
Thu, 09 Oct 2008 20:53:20 +0200
changeset 28551 91eec4012bc5
parent 28550 422e9bd169ac
child 28577 bd2456e0d944
permissions -rw-r--r--
added invalidate_group; SimpleThread.interrupt;

(*  Title:      Pure/Concurrent/simple_thread.ML
    ID:         $Id$
    Author:     Makarius

Simplified thread fork interface.
*)

signature SIMPLE_THREAD =
sig
  val fork: bool -> (unit -> unit) -> Thread.thread
  val interrupt: Thread.thread -> unit
end;

structure SimpleThread: SIMPLE_THREAD =
struct

fun fork interrupts body =
  Thread.fork (fn () => exception_trace (fn () => body ()),
    if interrupts then Multithreading.regular_interrupts else Multithreading.no_interrupts);

fun interrupt thread = Thread.interrupt thread handle Thread _ => ();

end;