Index

Package: Fully_Mutable_Lists (generic)

Description

generic package implements a thread-safe linked list that can be
-- modified by one thread while another is iterating. The list is locked at two
-- levels- the list level and the element level. The only restrictions are that
-- new elements can only be prepended or appended, and an element can't be
-- modified or removed from the list while it is being examined.
package Fully_Mutable_Lists is
This generic package implements a thread-safe linked list that can be modified by one thread while another is iterating. The list is locked at two levels- the list level and the element level. The only restrictions are that new elements can only be prepended or appended, and an element can't be modified or removed from the list while it is being examined.

Classes

List

type List is tagged limited private;

Primitive operations:

Find_Next
Iterate_With_Quit

References:

fully_mutable_lists.ads:32:10 (declaration)
fully_mutable_lists.adb:7:37 (reference)
fully_mutable_lists.adb:25:35 (reference)
fully_mutable_lists.adb:47:44 (reference)
fully_mutable_lists.adb:68:35 (reference)
fully_mutable_lists.adb:86:38 (reference)
fully_mutable_lists.adb:98:41 (reference)
fully_mutable_lists.adb:111:51 (reference)
fully_mutable_lists.adb:127:36 (reference)
fully_mutable_lists.adb:139:38 (reference)
fully_mutable_lists.adb:157:37 (reference)
fully_mutable_lists.ads:35:37 (reference)
fully_mutable_lists.ads:39:35 (reference)
fully_mutable_lists.ads:42:35 (reference)
fully_mutable_lists.ads:45:38 (reference)
fully_mutable_lists.ads:48:41 (reference)
fully_mutable_lists.ads:53:51 (reference)
fully_mutable_lists.ads:59:36 (reference)
fully_mutable_lists.ads:62:38 (reference)
fully_mutable_lists.ads:67:37 (reference)
fully_mutable_lists.ads:86:10 (full declaration)
fully_mutable_lists.ads:95:44 (reference)
fully_mutable_lists.ads:103:47 (reference)

Types

Cursor

type Cursor is private;

References:

fully_mutable_lists.ads:17:10 (declaration)
fully_mutable_lists.adb:25:80 (reference)
fully_mutable_lists.adb:68:49 (reference)
fully_mutable_lists.adb:70:20 (reference)
fully_mutable_lists.adb:100:20 (reference)
fully_mutable_lists.adb:114:20 (reference)
fully_mutable_lists.adb:157:61 (reference)
fully_mutable_lists.adb:187:40 (reference)
fully_mutable_lists.adb:196:34 (reference)
fully_mutable_lists.adb:207:38 (reference)
fully_mutable_lists.adb:214:39 (reference)
fully_mutable_lists.ads:20:40 (reference)
fully_mutable_lists.ads:23:34 (reference)
fully_mutable_lists.ads:26:38 (reference)
fully_mutable_lists.ads:30:39 (reference)
fully_mutable_lists.ads:39:80 (reference)
fully_mutable_lists.ads:42:49 (reference)
fully_mutable_lists.ads:67:61 (reference)
fully_mutable_lists.ads:101:10 (full declaration)

Constants & Global variables

CONTAINER_ERROR

CONTAINER_ERROR : exception;

References:

fully_mutable_lists.ads:70:5 (declaration)
fully_mutable_lists.adb:170:27 (reference)
fully_mutable_lists.adb:173:23 (reference)
fully_mutable_lists.adb:176:19 (reference)
fully_mutable_lists.adb:201:19 (reference)
fully_mutable_lists.adb:223:19 (reference)
Raised when a cursor is used to access the list improperly.

Subprograms & Entries

Close

procedure Close
( position: in out Cursor );

References:

fully_mutable_lists.ads:20:15 (declaration)
fully_mutable_lists.adb:187:15 (body)
fully_mutable_lists.adb:192:9 (label)
Closes the cursor, unlocking the list element it was examining.

Element

function Element
( position: Cursor )
return Element_Type;

References:

fully_mutable_lists.ads:23:14 (declaration)
fully_mutable_lists.adb:103:26 (reference)
fully_mutable_lists.adb:118:26 (reference)
fully_mutable_lists.adb:196:14 (body)
fully_mutable_lists.adb:203:9 (label)
Returns the value of the element the cursor is examining.

Has_Element

function Has_Element
( position: Cursor )
return Boolean;

References:

fully_mutable_lists.ads:26:14 (declaration)
fully_mutable_lists.adb:102:15 (reference)
fully_mutable_lists.adb:117:15 (reference)
fully_mutable_lists.adb:161:12 (reference)
fully_mutable_lists.adb:198:12 (reference)
fully_mutable_lists.adb:207:14 (body)
fully_mutable_lists.adb:210:9 (label)
fully_mutable_lists.adb:218:12 (reference)
Returns True if the cursor is examining a valid element.

Next

procedure Next
( position: in out Cursor );

References:

fully_mutable_lists.ads:30:15 (declaration)
fully_mutable_lists.adb:104:13 (reference)
fully_mutable_lists.adb:120:13 (reference)
fully_mutable_lists.adb:214:15 (body)
fully_mutable_lists.adb:225:9 (label)
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 );

References:

fully_mutable_lists.ads:35:15 (declaration)
fully_mutable_lists.adb:7:15 (body)
fully_mutable_lists.adb:20:9 (label)
Appends an element to the list.

Find

procedure Find
( this: access List;
element: Element_Type;
position: out Cursor );

References:

fully_mutable_lists.ads:39:15 (declaration)
fully_mutable_lists.adb:25:15 (body)
fully_mutable_lists.adb:42:9 (label)

Calls:

= defined at fully_mutable_lists.ads:8:18
Element defined at a-coorma.ads:73:13
First defined at a-coorma.ads:131:13
Has_Element defined at a-coorma.ads:161:13
Key defined at a-coorma.ads:71:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Next defined at a-coorma.ads:145:14
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;

References:

fully_mutable_lists.ads:42:14 (declaration)
fully_mutable_lists.adb:68:14 (body)
fully_mutable_lists.adb:81:9 (label)
fully_mutable_lists.adb:100:35 (reference)
fully_mutable_lists.adb:114:35 (reference)

Calls:

Element defined at a-coorma.ads:73:13
First defined at a-coorma.ads:131:13
Has_Element defined at a-coorma.ads:161:13
Key defined at a-coorma.ads:71:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Returns a cursor examining the first element in the list.

Is_Empty

function Is_Empty
( this: access List )
return Boolean;

References:

fully_mutable_lists.ads:45:14 (declaration)
fully_mutable_lists.adb:86:14 (body)
fully_mutable_lists.adb:93:9 (label)
Returns True if the list is empty.

Iterate

procedure Iterate
( this: access List;
examine: access procedure( element : Element_Type )
);

References:

fully_mutable_lists.ads:48:15 (declaration)
fully_mutable_lists.adb:98:15 (body)
fully_mutable_lists.adb:106:9 (label)
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 )
);

References:

fully_mutable_lists.ads:53:15 (declaration)
fully_mutable_lists.adb:111:15 (body)
fully_mutable_lists.adb:122:9 (label)
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;

References:

fully_mutable_lists.ads:59:14 (declaration)
fully_mutable_lists.adb:127:14 (body)
fully_mutable_lists.adb:134:9 (label)
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 );

References:

fully_mutable_lists.ads:62:15 (declaration)
fully_mutable_lists.adb:139:15 (body)
fully_mutable_lists.adb:152:9 (label)
Prepends an element to the list.

Remove

procedure Remove
( this: access List;
position: in out Cursor );

References:

fully_mutable_lists.ads:67:15 (declaration)
fully_mutable_lists.adb:157:15 (body)
fully_mutable_lists.adb:183:9 (label)

Calls:

Delete defined at a-coorma.ads:125:14
Delete defined at fully_mutable_lists.ads:82:15
Find defined at a-coorma.ads:151:13
Has_Element defined at fully_mutable_lists.ads:26:14
Has_Element defined at a-coorma.ads:161:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
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.