Ada 95 Quality and Style Guide Chapter 7

Chapter 7: Portability - TOC - 7.4 TASKING

7.4.7 Unprotected Shared Variables and Pragmas Atomic and Volatile

guideline

  • Do not use unprotected shared variables.
  • Consider using protected types to provide data synchronization.
  • Have tasks communicate through the rendezvous mechanism.
  • Do not use unprotected shared variables as a task synchronization device.
  • Consider using protected objects to encapsulate shared data.
  • Use pragma Atomic or Volatile only when you are forced to by run-time system deficiencies.

  • example

    See Guidelines 6.1.1 and 6.1.2.

    rationale

    The rationale for this appears in Guidelines 6.1.1 and 6.2.4. In addition, the treatment of unprotected shared variables varies from implementation to implementation, thereby hindering portability.


    < Previous Page Search Contents Index Next Page >
    1 2 3 4 5 6 7 8 9 10 11
    TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC
    Appendix References Bibliography