There is, in YAL, a special kind of subroutine, called a SERVER, which is used to allow communications between parallel tasks to be more elaborate than possible by the use of CONTROLLED variables or the LINK statement.
A program (often, the main program) calls a SERVER by a statement of the form
which calls the SERVER program with the header statement
which then proceeds, possibly in parallel with the calling program, like a normal subroutine called with an INITIATE statement, until it executes a statement of the form
which causes two things two happen: the SERVER program suspends its execution, and it becomes possible for other programs to call entry points of the SERVER program which were declared by statements of the form
SERVICE name(...) & linenumber
with a statement of the form
Unlike a regular subroutine, however, when multiple parallel processes call a SERVER, they do not cause new copies of it to be made, nor do such calls execute in parallel. Instead, a routine requesting a service must wait until no other part of the same server is executing.
In addition, some SERVICEs may be declared temporarily unavailable by the statement
which simply causes processes requesting the named services to wait until they are made available again by
These two statements may be found anywhere in a SERVER, although a SERVICE cannot declare itself USEFUL. If a SERVICE declares itself USELESS, it still continues executing in response to the request it was serving, but it becomes unavailable after it finishes (with a normal STOP or RETURN statement).
A SERVICE can also cause the main line of its SERVER to resume, by fall-through out of a SERVE statement, by executing the statement
This takes place after return from the SERVICE. Multiple ADVANCE statements executed within one SERVICE have the effect of a single ADVANCE statement; to indicate a special request of the SERVER, a SERVICE must set a variable used by both (as they are entry points of the same routine, EXTERNAL and AVAILABLE statements are not used here).
Also, the main program that ACTIVATEd a SERVER can turn it off abruptly by executing a statement of the form
where name is the name of the SERVER.