Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,17 +0,0 @@
|
|||
with Ada.Text_IO, Ada.Numerics.Float_Random;
|
||||
|
||||
procedure Concurrent_Hello is
|
||||
type Messages is (Enjoy, Rosetta, Code);
|
||||
task type Writer (Message : Messages);
|
||||
task body Writer is
|
||||
Seed : Ada.Numerics.Float_Random.Generator;
|
||||
begin
|
||||
Ada.Numerics.Float_Random.Reset (Seed); -- time-dependent, see ARM A.5.2
|
||||
delay Duration (Ada.Numerics.Float_Random.Random (Seed));
|
||||
Ada.Text_IO.Put_Line (Messages'Image(Message));
|
||||
end Writer;
|
||||
Taks: array(Messages) of access Writer -- 3 Writer tasks will immediately run
|
||||
:= (new Writer(Enjoy), new Writer(Rosetta), new Writer(Code));
|
||||
begin
|
||||
null; -- the "environment task" doesn't need to do anything
|
||||
end Concurrent_Hello;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import system'threading;
|
||||
import extensions'threading;
|
||||
|
||||
async public program()
|
||||
async public Program()
|
||||
{
|
||||
Task t1 := Task.run({ Console.printLineConcurrent("Enjoy") });
|
||||
Task t2 := Task.run({ Console.printLineConcurrent("Rosetta") });
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
procedure echo(sequence s)
|
||||
puts(1,s)
|
||||
puts(1,'\n')
|
||||
end procedure
|
||||
|
||||
atom task1,task2,task3
|
||||
|
||||
task1 = task_create(routine_id("echo"),{"Enjoy"})
|
||||
task_schedule(task1,1)
|
||||
|
||||
task2 = task_create(routine_id("echo"),{"Rosetta"})
|
||||
task_schedule(task2,1)
|
||||
|
||||
task3 = task_create(routine_id("echo"),{"Code"})
|
||||
task_schedule(task3,1)
|
||||
|
||||
task_yield()
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
(notonline)-->
|
||||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (threads)</span>
|
||||
<span style="color: #008080;">procedure</span> <span style="color: #000000;">echo</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">sleep</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">rand</span><span style="color: #0000FF;">(</span><span style="color: #000000;">100</span><span style="color: #0000FF;">)/</span><span style="color: #000000;">100</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">enter_cs</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">'\n'</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">leave_cs</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
|
||||
without js -- (threads)
|
||||
procedure echo(string s)
|
||||
sleep(rand(100)/100)
|
||||
enter_cs()
|
||||
puts(1,s)
|
||||
puts(1,'\n')
|
||||
leave_cs()
|
||||
end procedure
|
||||
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">threads</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">create_thread</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">routine_id</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"echo"</span><span style="color: #0000FF;">),{</span><span style="color: #008000;">"Enjoy"</span><span style="color: #0000FF;">}),</span>
|
||||
<span style="color: #000000;">create_thread</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">routine_id</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"echo"</span><span style="color: #0000FF;">),{</span><span style="color: #008000;">"Rosetta"</span><span style="color: #0000FF;">}),</span>
|
||||
<span style="color: #000000;">create_thread</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">routine_id</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"echo"</span><span style="color: #0000FF;">),{</span><span style="color: #008000;">"Code"</span><span style="color: #0000FF;">})}</span>
|
||||
constant threads = {create_thread(routine_id("echo"),{"Enjoy"}),
|
||||
create_thread(routine_id("echo"),{"Rosetta"}),
|
||||
create_thread(routine_id("echo"),{"Code"})}
|
||||
|
||||
<span style="color: #000000;">wait_thread</span><span style="color: #0000FF;">(</span><span style="color: #000000;">threads</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"done"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">wait_key</span><span style="color: #0000FF;">()</span>
|
||||
<!--
|
||||
wait_thread(threads)
|
||||
puts(1,"done")
|
||||
{} = wait_key()
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
$Strings = "Enjoy","Rosetta","Code"
|
||||
|
||||
$SB = {param($String)Write-Output $String}
|
||||
|
||||
foreach($String in $Strings) {
|
||||
Start-Job -ScriptBlock $SB -ArgumentList $String | Out-Null
|
||||
}
|
||||
|
||||
Get-Job | Wait-Job | Receive-Job
|
||||
Get-Job | Remove-Job
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
$Strings = "Enjoy","Rosetta","Code"
|
||||
|
||||
$SB = {param($String)Write-Output $String}
|
||||
|
||||
$Pool = [RunspaceFactory]::CreateRunspacePool(1, 3)
|
||||
$Pool.ApartmentState = "STA"
|
||||
$Pool.Open()
|
||||
foreach ($String in $Strings) {
|
||||
$Pipeline = [System.Management.Automation.PowerShell]::create()
|
||||
$Pipeline.RunspacePool = $Pool
|
||||
[void]$Pipeline.AddScript($SB).AddArgument($String)
|
||||
$AsyncHandle = $Pipeline.BeginInvoke()
|
||||
$Pipeline.EndInvoke($AsyncHandle)
|
||||
$Pipeline.Dispose()
|
||||
}
|
||||
$Pool.Close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue