Index

Package: Fully_Mutable_Lists (generic)

Description

generic
   type Element_Type is private;

   with function "="( left, right : Element_Type ) return Boolean is <>;

-- This generic package implements a thread-safe linked list that can be
-- modified by one thread while another is

Classes

List

type List is tagged limited private;

Primitive operations:

Find_Next
Iterate_With_Quit
This is the fully mutable list type.

Types

Element_Type

type Element_Type is private;

Constants & Global variables

CONTAINER_ERROR

CONTAINER_ERROR : exception;
Raised when a cursor is used to access the list improperly.

Subprograms & Entries

=

function "="
( left, right: Element_Type ) return Boolean is <>;

Close

procedure Close
( position: in out Cursor );
Closes the cursor, unlocking the list element it was examining.

Element

function Element
( position: Cursor ) return Element_Type;
Returns the value of the element the cursor is examining.

Has_Element

function Has_Element
( position: Cursor ) return Boolean;
Returns True if the cursor is examining a valid element.

Next

procedure Next
( position: in out Cursor );
Traverses to the next element in the list. The caller will block until the next element is unlocked.

Append

procedure Append
( this: access List;
element: Element_Type );
Appends an element to the list.

Find

procedure Find
( this: access List;
element: Element_Type;
position: out Cursor );
Finds an element in the list, returning a cursor to it. If the element isn't in the list, an empty cursor will be returned.

First

function First
( this: access List ) return Cursor;
Returns a cursor examining the first element in the list.

Is_Empty

function Is_Empty
( this: access List ) return Boolean;
Returns True if the list is empty.

Iterate

procedure Iterate
( this: access List;
examine: access procedure( element : Element_Type ) );
Iterates forward over the list.

Iterate_With_Quit

procedure Iterate_With_Quit
( this: access List;
examine: access procedure( element : Element_Type;
quit: in out Boolean ) );
Iterates forward over the list with an early exit option. Set 'quit' to True in the 'examine' procedure to stop iterating.

Length

function Length
( this: access List ) return Natural;
Returns the current size of the list. This should not be relied upon, as the list size may be changed by another thread immediately after return.

Prepend

procedure Prepend
( this: access List;
element: Element_Type );
Prepends an element to the list.

Remove

procedure Remove
( this: access List;
position: in out Cursor );
It is possible that the position being removed is currently being examined. So- if the list contains pointers it is not safe to assume an object can be deleted after removing it from the list.