Mutex: Difference between revisions

Content added Content deleted
(Ada's implementation of mutex)
(Some explanation of Ada implementation)
Line 46: Line 46:
end Mutex;
end Mutex;
</ada>
</ada>
Here the entry Seize has a queue of the [[task]]s waiting for the mutex. The entry's barrier is closed when Owned is true. So any task calling to the entry will be queued. When the barrier is open the first task from the queue executes the entry and Owned becomes false closing the barrier again. The procedure Release simply sets Owned to false. Both Seize and Release are protected actions which execution causes reevaluation of all barriers, in this case one of Seize.

Use:
Use:
<ada>
<ada>