class class_name(threading.Thread) {[override run method] } | Python |
task task_name is [entry entry_name[(parameter ...)]...] end task_name | Ada |
task type task_type_name is [entry entry_name[(parameter ...)]...] end task_type_name | Ada |
class class_name extends Thread {[override run method] } | Java |
thread ... | Pliant |
parallel [threads nb_threads] [mini mini_threshold] [maxi maxi_threshold] [active] ... task parallel_instructions [post sequential_instructions] ... | Pliant |
[NSThread detachNewThreadSelector:mainFunction toTarget:target withObject:obj] | Objective-C |
object t=Thread.Thread(f) | Pike |
set t [thread create {code}] | Tcl |
Thread createThread(...) | Io |
MyTask : task_type_name; | Ada |
class_name MyThread = new class_name() | Java |
p := [ ... ] newProcess. | Smalltalk |
p := [ ... ] fork.(1) | Smalltalk |
start() / stop()(2) | Java |
resume / suspend / terminate | Smalltalk |
Tasks are started when created / call Stop entry or "abort task-object-name" | Ada |
thread send $t {script} | Tcl |
call an entry with parameters | Ada |
call any public method | Java |
common variables are copied at thread creation, in abscence of a "share" statement | Pliant |
use messages, parameters or shared variables(3) | Smalltalk |
select task_entry_call; or delay timeout_limit; end select; | Ada |
Defining a Synchronized Shared Resource
thread::mutex | Tcl |
protected Object_Name is [entry entry_name(Parameter : [in out] is type [...]); procedure procedure_name(Parameter : [in out] is type [...]); function function_name return type; private shared data declaration end Object_Name; | Ada |
synchronize (this){ ... } | Java |
SharedQueue, Semaphore critical: [...], Future, LazyValue | Smalltalk |
Synchronized Writing to a shared resource
Object_Name.Entry_Name(Parms) Object_Name.Procedure_Name(Parms) | Ada |
Object_Name.SetMethod(Parms) | Java |
Synchronized Reading of a Shared Resource
Object_Name.Function_Name | Ada |
Object_Name.GetMethod() | Java |
Monitor Syntax
Objectg_Name.Entry_Name(Parms) | Ada |
Suspending a thread until another thread completes
Call task entry serviced just before task termination | Ada |
OtherThread.join() | Java, Python |
Suspending a Thread Until Another Thread Establishes An Internal State
Call a task entry on the other thread | Ada |
Selecting a Prioritization Model
pragma Locking_Policy(Ceiling_Locking); | Ada |
Establishing a base thread priority
pragma Priority(expression); | Ada |
Changing Thead Priority
Set_Priority(Priority_Value); | Ada |
setPriority(newPriority); | Java |
p priority: n | Smalltalk |
Ensuring access is atomic
pragma Atomic(Object_Name); | Ada |
Ensuring access is always via a local copy of the shared data
pragma Volatile(Object_Name); | Ada |