equal
deleted
inserted
replaced
7 signature MULTITHREADING = |
7 signature MULTITHREADING = |
8 sig |
8 sig |
9 val max_threads: unit -> int |
9 val max_threads: unit -> int |
10 val max_threads_update: int -> unit |
10 val max_threads_update: int -> unit |
11 val enabled: unit -> bool |
11 val enabled: unit -> bool |
12 val sync_wait: Thread.threadAttribute list option -> Time.time option -> |
12 val sync_wait: Time.time option -> ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result |
13 ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result |
|
14 val trace: int ref |
13 val trace: int ref |
15 val tracing: int -> (unit -> string) -> unit |
14 val tracing: int -> (unit -> string) -> unit |
16 val tracing_time: bool -> Time.time -> (unit -> string) -> unit |
15 val tracing_time: bool -> Time.time -> (unit -> string) -> unit |
17 val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a |
16 val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a |
18 end; |
17 end; |
45 end; |
44 end; |
46 |
45 |
47 |
46 |
48 (* synchronous wait *) |
47 (* synchronous wait *) |
49 |
48 |
50 fun sync_wait opt_atts time cond lock = |
49 fun sync_wait time cond lock = |
51 Thread_Attributes.with_attributes |
50 Thread_Attributes.with_attributes |
52 (Thread_Attributes.sync_interrupts |
51 (Thread_Attributes.sync_interrupts (Thread.getAttributes ())) |
53 (case opt_atts of SOME atts => atts | NONE => Thread.getAttributes ())) |
|
54 (fn _ => |
52 (fn _ => |
55 (case time of |
53 (case time of |
56 SOME t => Exn.Res (ConditionVar.waitUntil (cond, lock, t)) |
54 SOME t => Exn.Res (ConditionVar.waitUntil (cond, lock, t)) |
57 | NONE => (ConditionVar.wait (cond, lock); Exn.Res true)) |
55 | NONE => (ConditionVar.wait (cond, lock); Exn.Res true)) |
58 handle exn => Exn.Exn exn); |
56 handle exn => Exn.Exn exn); |