equal
deleted
inserted
replaced
4 Multithreading in Poly/ML (cf. polyml/basis/Thread.sml). |
4 Multithreading in Poly/ML (cf. polyml/basis/Thread.sml). |
5 *) |
5 *) |
6 |
6 |
7 signature MULTITHREADING = |
7 signature MULTITHREADING = |
8 sig |
8 sig |
9 val interrupted: unit -> unit (*exception Interrupt*) |
|
10 val max_threads_value: unit -> int |
9 val max_threads_value: unit -> int |
11 val max_threads_update: int -> unit |
10 val max_threads_update: int -> unit |
12 val enabled: unit -> bool |
11 val enabled: unit -> bool |
13 val sync_wait: Thread.threadAttribute list option -> Time.time option -> |
12 val sync_wait: Thread.threadAttribute list option -> Time.time option -> |
14 ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result |
13 ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result |
19 val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a |
18 val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a |
20 end; |
19 end; |
21 |
20 |
22 structure Multithreading: MULTITHREADING = |
21 structure Multithreading: MULTITHREADING = |
23 struct |
22 struct |
24 |
|
25 (* interrupts *) |
|
26 |
|
27 fun interrupted () = |
|
28 let |
|
29 val orig_atts = Thread_Attributes.safe_interrupts (Thread.getAttributes ()); |
|
30 val _ = Thread.setAttributes Thread_Attributes.test_interrupts; |
|
31 val test = Exn.capture Thread.testInterrupt (); |
|
32 val _ = Thread.setAttributes orig_atts; |
|
33 in Exn.release test end; |
|
34 |
|
35 |
23 |
36 (* options *) |
24 (* options *) |
37 |
25 |
38 fun num_processors () = |
26 fun num_processors () = |
39 (case Thread.numPhysicalProcessors () of |
27 (case Thread.numPhysicalProcessors () of |