46
47
48
49
50
51
52
53
|
return Boolean is <>;
-- Check whether there is still a job to do
procedure Single_Accumulator_Run
(Global : in out Global_State;
Task_Count : in Positive);
end Natools.Parallelism;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
|
return Boolean is <>;
-- Check whether there is still a job to do
procedure Single_Accumulator_Run
(Global : in out Global_State;
Task_Count : in Positive);
generic
type Global_State (<>) is limited private;
-- State common to all jobs, only accessed from protected subprograms
type Task_Result is limited private;
-- Accumulated result in a single task
type Job_Description is limited private;
-- Parameters for a given job
with procedure Initialize (Result : in out Task_Result) is <>;
-- Initialize Result for the current task
with procedure Get_Next_Job
(Global : in out Global_State;
Job : out Job_Description;
Terminated : out Boolean) is <>;
-- If there is a next job available from Global, set Terminated
-- to False and initialize Job, otherwise set Terminated to True.
with procedure Do_Job
(Result : in out Task_Result;
Job : in Job_Description) is <>;
-- Perform the job in parallel
with procedure Gather_Result
(Global : in out Global_State;
Partial : in Task_Result) is <>;
-- Update Global with results stored in Partial
procedure Per_Task_Accumulator_Run
(Global : in out Global_State;
Task_Count : in Positive);
end Natools.Parallelism;
|