Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions courses/ada_essentials/245_ravenscar_tasking/02-tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Ravenscar Tasks Declaration Example
package My_Tasks is
task type Printer;

P1 : Printer;
P2 : Printer;
Printer_Task_1 : Printer;
Printer_Task_2 : Printer;
end My_Tasks;

:filename:`my_tasks.adb`
Expand All @@ -45,7 +45,7 @@ Ravenscar Tasks Declaration Example
with Ada.Real_Time; use Ada.Real_Time;

package body My_Tasks is
P3 : Printer; -- correct
Printer_Task_3 : Printer; -- correct

task body Printer is
Period : Time_Span := Milliseconds (100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Priorities
procedure Main is
pragma Priority (2);

task T is
task Some_Task is
pragma Priority (4);

protected Buffer is
Expand Down Expand Up @@ -167,18 +167,18 @@ Ceiling Locking

.. code::

L : Lock;
The_Lock : Lock;

T1 : Task (Priority => 1);
T2 : Task (Priority => 2);
T3 : Task (Priority => 3);

T1 locks L
T1 locks The_Lock
T3 starts, get scheduled (T3 > T1)
T3 tries to get L, blocks
T3 tries to get The_Lock, blocks
T2 starts, get scheduled (T2 > T1)

Result: T2 running, T1 blocked, T3 blocked through L (but T3 > T2!)
Result: T2 running, T1 blocked, T3 blocked through The_Lock (but T3 > T2!)

* Solved with ceiling locking

Expand All @@ -200,7 +200,7 @@ Ceiling Locking Example
.. code:: Ada

protected P with Priority => 5 is
procedure Set (V : Integer);
procedure Set (Val : Integer);

.. code:: Ada

Expand Down