VMS Help  —  CRTL  putc_unlocked
    Same as putc, except used only within a scope protected by
    flockfile and funlockfile.

    This function is OpenVMS Alpha and Integrity servers only.

    Format

      #include  <stdio.h>

      int putc_unlocked  (int character, FILE *file_ptr);

1  –  Argument

 character

    The character to be written.

 file_ptr

    A file pointer to the output stream.

2  –  Description

    The reentrant version of the putc macro is locked against
    multiple threads calling it simultaneously. This incurs overhead
    to ensure integrity of the stream. The unlocked version of this
    call, putc_unlocked can be used to avoid the overhead. The putc_
    unlocked macro is functionally identical to the putc macro,
    except that it is not required to be implemented in a thread-
    safe manner. The putc_unlocked macro can be safely used only
    within a scope that is protected by the flockfile and funlockfile
    functions used as a pair. The caller must ensure that the stream
    is locked before putc_unlocked is used.

    Since putc_unlocked is a macro, a file pointer argument with side
    effects might be evaluated incorrectly. In such a case, use the
    fputc_unlocked function instead.

    Compiling with the __UNIX_PUTC macro defined enables an
    optimization that uses a faster, inlined version of this
    function.

    See also flockfile, ftrylockfile, and funlockfile.

3  –  Return Values

    x                  The character written to the file. Indicates
                       success.
    EOF                Indicates the end-of-file or an error.
Close Help