Ada 95 Quality and Style Guide Chapter 6
6.2.3 Attributes 'Count, 'Callable, and 'Terminated
guideline
guideline
Multiple tasks sharing the predefined random number generator
and certain input/output subprograms can lead to problems with
unprotected updates to shared state. The Ada Reference Manual
(1995, §A.5.2) points out the need for tasks to synchronize
their access to the random number generators (packages Ada.Numerics.Float_Random
and Ada.Numerics.Discrete_Random). See Guideline 7.7.5
for the I/O issue.
6.2.5 Selective Accepts and Entry Calls
guideline
guideline
The ability of tasks to interact with each other using Ada's intertask
communication features makes it especially important to manage
planned or unplanned (e.g., in response to a catastrophic exception
condition) termination in a disciplined way. To do otherwise can
lead to a proliferation of undesired and unpredictable side effects
as a result of the termination of a single task.
The guidelines on termination focus on the termination of tasks.
Wherever possible, you should use protected objects (see Guideline
6.1.1), thus avoiding the termination problems associated with
tasks.
6.3.1 Avoiding Undesired Termination
guideline
guideline
guideline
guideline
guideline
guideline
concurrency options
Explicitly shut down tasks that depend on library packages.
Confirm that a task is terminated before freeing it with Ada.Unchecked_Deallocation.
example
example
If your environment supports the Systems Programming Annex (Ada
Reference Manual 1995, Annex C), you should indicate whether loads
and stores to the shared object must be indivisible. If you specify
the pragma Atomic, make sure that the object meets the
underlying hardware requirements for size and alignment.
example
example
6.3 TERMINATION
example
example
example
example
rationale
rationale
6.4 SUMMARY
communication
termination
In This Guide:
Table of Contents
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Appendix
References
Bibliography
Index