The task of this exercise is to implement Queues in Funnel
using join synchronization. In a queue, data is stored and
retrieved according to the FIFO (first in first out) principle.
A queue is supposed to support at least two operations: put
and get .
With put , a new element x is appended
to the end of a queue. get returns
the first available element.
Implement a constructor newQueue that returns
an empty queue, represented by a record consisting of at least
the two functions put and get .
def newQueue = {
...
}
Your implementation should be synchronized, so that it can be
used in concurrent programs.
|