Example 1 – Tasking in ADA

task SERVER is

entry TASK_A(A,B:float);

entry TASK_B(A,B:float);

task body SERVER is

begin

loop

select

accept TASK_A(A,B:float);

or

accept TASK_B(A,B:float);

or

terminate;

end select;

end loop;

end SERVER;


 

The above program implements a server which serves the two Queues TASK_A and TASK_B through the float variable A and B. The Server is running with a infinite loop so the server is always serving either of the two queues. if the both the queues are empty, then the SERVER task will terminate. if both the queues are full, then the task will take from any one of the queue at a random fashion.

Comments

Popular Posts