61
62
63
64
65
66
67
68
|
Workers : array (1 .. Task_Count) of Worker;
pragma Unreferenced (Workers);
begin
null;
end Single_Accumulator_Run;
end Natools.Parallelism;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
Workers : array (1 .. Task_Count) of Worker;
pragma Unreferenced (Workers);
begin
null;
end Single_Accumulator_Run;
procedure Per_Task_Accumulator_Run
(Global : in out Global_State;
Task_Count : in Positive)
is
protected State is
procedure Get_Next_Job
(Job : out Job_Description;
Terminated : out Boolean);
procedure Gather (Result : in Task_Result);
end State;
task type Worker is
end Worker;
protected body State is
procedure Get_Next_Job
(Job : out Job_Description;
Terminated : out Boolean) is
begin
Get_Next_Job (Global, Job, Terminated);
end Get_Next_Job;
procedure Gather (Result : in Task_Result) is
begin
Gather_Result (Global, Result);
end Gather;
end State;
task body Worker is
Job : Job_Description;
Result : Task_Result;
Terminated : Boolean;
begin
Initialize (Result);
loop
State.Get_Next_Job (Job, Terminated);
exit when Terminated;
Do_Job (Result, Job);
end loop;
State.Gather (Result);
end Worker;
Workers : array (1 .. Task_Count) of Worker;
pragma Unreferenced (Workers);
begin
null;
end Per_Task_Accumulator_Run;
end Natools.Parallelism;
|