HP 3000 Manuals

stdio Interfaces [ DCE for the HP 3000 ] MPE/iX 5.0 Express III Documentation


DCE for the HP 3000

stdio Interfaces 

Some of the stdio interfaces (such as getchar() and putchar()) are
available as functions within C/XL and as macros defined in stdio.h.  The
macro versions exist for performance reasons.  Calls to the library
implementation of these interfaces is intercepted by the thread wrapper
functions, making them thread-safe; but the macros have not been made
thread-safe.  Since the thread-safe wrapper implementations should be
used by default, the names of the macros have been changed by adding an
_unlocked suffix (for example, getchar_unlocked()).  This allows
programmers to invoke the _unlocked macros and not pay the performance
penalty of an extra function call and the cost of acquiring and releasing
a lock.

Some of the _unlocked interfaces are outlined in POSIX 1003.4a, Draft 5.
To support the use of the _unlocked interfaces, the functions flockfile()
and funlockfile() are provided.  These functions can be used to
explicitly lock and unlock a file object.  Therefore, exclusive access to
a file for a series of _unlocked stdio calls is ensured, without having
to lock and unlock the file on every call.

The additional stdio interfaces in thdwrp.h are:

     getc_unlocked   getchar_unlocked
     putc_unlocked   putchar_unlocked

The functions flockfile() and funlockfile() are implemented as part of
/usr/lib/libdce.a.



MPE/iX 5.0 Express III Documentation