I have a large, heavily task oriented program, and I would like to explore variant scheduler policies. I am using Gnat Ada 2020. In particular, I would like to set the tasking model by use of the pragma:
pragma Task_Dispatching_Policy(Non_Preemptive_FIFO_Within_Priorities);
I don't think I understand the actual usage very well. I understand what the pragma does, but I am having difficulty placing the pragma correctly, at least according to GNAT. For various combinations of placement in the following small program, I always get the error : "incorrect placement for configuration pragma "Task_Dispatching_Policy" I have tried outside of the whole compilation unit, within the task type spec, within the task body spec, etc. Can anyone show me an example of usage of this pragma? Googling found many discussions but no actual examples of usage in source code. Thanks in advance.
with Ada.Text_IO; Use Ada.Text_Io;
procedure Test is
Task Type One is
End;
Task Type Two;
Task body One is
Begin
Loop
Put_line("Task one 11111111111111111");
End Loop;
End;
Task body Two is
Begin
Loop
Put_line("Task two 2222222222222222");
End Loop;
End;
a : One;
B : two;
begin
Null;
End;
As suggested below, I found something in the UG about placing the pragma in a 'gnat.adc' file, and that seemed to take effect but did not completely prevent the switching, which is what I expected. I should mention I am on a Windows 10 environment.
I consider this as answered by way of @egilhh's comment. Will be glad to accept his if he posts one I am able to accept on.