Ada '83 Quality and Style, Sec 6.4: Chapter 6 Summary
Ada '83 Quality and Style:
Guidelines for Professional Programmers
CHAPTER 6: Concurrency
- Use tasks to model asynchronous entities within the problem domain.
- Use tasks to control or synchronize access to tasks or devices.
- Use tasks to define concurrent algorithms.
- Use anonymous task types for single instances.
- Justify the use of dynamically allocated task objects.
- Avoid disassociating a dynamic task from all names.
- Do not rely on pragma
Priority to prioritize the service of entries.
- Arrange task bodies in order of their priorities (if possible).
- Do not depend on a particular delay being achievable.
- Do not use a busy waiting loop instead of a delay.
- Design to limit polling to those cases where absolutely necessary.
- Do not use knowledge of the execution pattern of tasks to achieve
timing requirements.
- Minimize the work performed during a rendezvous.
- Minimize the work performed in the selective wait loop of a task.
- Provide a handler for exception
Program_Error whenever you cannot
avoid a selective wait statement whose alternates can all be closed.
- Make systematic use of handlers for
Tasking_Error.
- Be prepared to handle exceptions during a rendezvous.
- Do not depend on the values of the task attributes
'Callable or
'Terminated.
- Do not depend on attributes to avoid
Tasking_Error on an entry call.
- Do not depend on the value of the entry attribute
'Count.
- Use the rendezvous mechanism, not shared variables, to pass data
between tasks.
- Do not use shared variables as a task synchronization device.
- Do not reference nonlocal variables in a guard.
- Use caution with conditional entry calls.
- Use caution with selective waits with else parts.
- Do not depend upon a particular delay in timed entry calls.
- Do not depend upon a particular delay in selective waits with delay
alternatives.
- Minimize the number of accept and select statements per task.
- Minimize the number of accept statements per entry.
- Place an exception handler for a rendezvous within the main tasking
loop.
- Do not create non-terminating tasks unintentionally.
- Explicitly shut down tasks dependent on library packages.
- Use a select statement rather than an accept statement alone.
- Provide a terminate alternative for every selective wait that does not
require an else part or a delay.
- Avoid using the abort statement.
- Place an exception handler for others at the end of a task body.
- Have each exception handler at the end of a task body report the
task's demise.
Back to document index
This file was converted with TextToHTML - (c) Logic n.v.