NAME
          aprintf, afprintf - Cthreads atomic formatted output conver-
          sion

     LIBRARY
          C Threads Library (libcthreads.a)

     SYNOPSIS
          #include <stdio.h>
          #include <cthread.h>

          int aprintf(format [ , arg... ] )
          char *format;

          int afprintf(stream, format [ , arg... ] )
          FILE *stream;
          char *format;

          void aprintf_lock( )

          void aprintf_unlock( )


     DESCRIPTION
          These calls provide an "atomic" printf facility for Cthreads
          programs.  On machines like the KSR, concurrent printf()
          calls can be intermixed character-by-character or just trash
          each other completely.  These routines provide a printf
          facility in which the individual printf calls will not
          interfere with each other.  Each aprintf() or afprintf()
          will be atomic in the sense that it will not be broken up by
          characters from other atomic printf calls. To accomplish
          this, aprintf() locks a mutex, calls printf(), and unlocks
          the mutex. afprintf() uses the same mutex.  By using
          aprintf_lock() and aprintf_unlock(), multiple printf state-
          ments can be combined into an atomic whole.  In general,
          aprintf() can be used wherever printf() is used and
          afprintf() can be substituted for fprintf().

          N.B.  Regular, unprotected printf() calls can interfere with
          these atomic versions.  Also, because these atomic calls all
          contend for a single global mutex, they should be used spar-
          ingly in the performance phase of an application.  Of
          course, printf's in general should be used sparingly in the
          performance phase of an application, so that shouldn't be a
          problem.

     SEE ALSO
          printf(3), fprintf(3)

     AUTHOR
          Cthreads was written and maintained by many people.
          This man page written by Greg Eisenhauer.