# HG changeset patch # User wenzelm # Date 1220802400 -7200 # Node ID 26bd1245a46b3c2981d5cd73ae87b0621f83feda # Parent a472d844994e4dfd3cabde9f51aa938929aee6c7 added no_interrupts; moved dummy thread structures to dummy_thread.ML; diff -r a472d844994e -r 26bd1245a46b src/Pure/ML-Systems/multithreading.ML --- a/src/Pure/ML-Systems/multithreading.ML Sun Sep 07 17:46:39 2008 +0200 +++ b/src/Pure/ML-Systems/multithreading.ML Sun Sep 07 17:46:40 2008 +0200 @@ -2,7 +2,7 @@ ID: $Id$ Author: Makarius -Default implementation of multithreading interface -- mostly dummies. +Dummy implementation of multithreading setup. *) signature BASIC_MULTITHREADING = @@ -19,6 +19,7 @@ val available: bool val max_threads: int ref val max_threads_value: unit -> int + val no_interrupts: Thread.threadAttribute list val self_critical: unit -> bool val serial: unit -> int end; @@ -35,6 +36,8 @@ val max_threads = ref (1: int); fun max_threads_value () = Int.max (! max_threads, 1); +val no_interrupts = []; + (* critical section *) @@ -53,80 +56,3 @@ structure BasicMultithreading: BASIC_MULTITHREADING = Multithreading; open BasicMultithreading; - - -(** dummy thread structures (cf. polyml/basis/Thread.sml) **) - -exception Thread of string; - -local fun fail _ = raise Thread "No multithreading support on this ML platform" in - -structure Mutex = -struct - type mutex = unit; - fun mutex _ = fail (); - fun lock _ = fail (); - fun unlock _ = fail (); - fun trylock _ = fail (); -end; - -structure ConditionVar = -struct - type conditionVar = unit; - fun conditionVar _ = fail (); - fun wait _ = fail (); - fun waitUntil _ = fail (); - fun signal _ = fail (); - fun broadcast _ = fail (); -end; - -structure Thread = -struct - type thread = unit; - - datatype threadAttribute = EnableBroadcastInterrupt of bool | InterruptState of interruptState - and interruptState = InterruptDefer | InterruptSynch | InterruptAsynch | InterruptAsynchOnce; - - fun fork _ = fail (); - fun exit _ = fail (); - fun isActive _ = fail (); - - fun equal _ = fail (); - fun self _ = fail (); - - fun interrupt _ = fail (); - fun broadcastInterrupt _ = fail (); - fun testInterrupt _ = fail (); - - fun kill _ = fail (); - - fun setAttributes _ = fail (); - fun getAttributes _ = fail (); - - fun numProcessors _ = fail (); - - -(* thread data *) - -local - -val data = ref ([]: Universal.universal ref list); - -fun find_data tag = - let - fun find (r :: rs) = if Universal.tagIs tag (! r) then SOME r else find rs - | find [] = NONE; - in find (! data) end; - -in - -fun getLocal tag = Option.map (Universal.tagProject tag o !) (find_data tag); - -fun setLocal (tag, x) = - (case find_data tag of - SOME r => r := Universal.tagInject tag x - | NONE => data := ref (Universal.tagInject tag x) :: ! data); - -end; -end; -end;