The Ada language includes a synchronisation facility called the
rendezvous.
The rendezvous allows arbitrary processes to synchronise with each
other and exchange data at that point.
Somewhere in the <#377#> task<#377#> specification, there is one or more <#378#> entry<#378#>
declarations. These are analogous to procedure (method) declarations in a
package (class).
There is a corresponding <#379#> accept<#379#> statement which contains the
declaration of the executable statements that implement this
entry.
The <#380#> accept<#380#> and corresponding call to this rendezvous are <#381#> strongly<#381#>
synchronized. This means that the called task is suspended at an
<#382#> accept<#382#> until the
caller calls this entry. The caller is then suspended until the called
task completes execution of the end of the accept statement/block.
The <#383#> entry<#383#> and call can pass in, out and in-out parameters.
In this sense it is analogous to a remote procedure call (RPCs are
discussed later in this chapter). Its use is
illustrated in figure #fnada2#384>
Two active processes are proceeding with their execution.
In a symmetric way, whichever reaches the rendezvous first, waits.
When both reach the rendezvous, a single transaction takes place.
The transaction is exclusive so that consistency problems are
avoided.
The second example is rather artificial. It would almost certainly
deadlock unless events arrived strictly alternately from the mouse and
keyboard - an extremely unlikely situation.
It is possible to schedule the rendezvous with delays and priorities.
By default, some notion of fair scheduling is expected.
A <#388#> select<#388#> statement allows a task to choose from one of several
possible rendezvous. The <#389#> select<#389#> may be ;SPM_quot;guarded;SPM_quot; by a <#390#> when<#390#>
clause.
We can solve the problem in the last example, and even improve it by
introducing priorities to make sure that mouse events are dealt with
more promptly that keyboard ones (this is reasonable when a fast
tracked mouse might traverse several hundred pixels in the time it
takes to type a character). This is illustrated in #fnada3#391>
Figure:
Figure: