VMS Help  —  CRTL  getc_unlocked
    Same as getc, 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 getc_unlocked  (FILE *file_ptr);

1  –  Argument

 file_ptr

    A file pointer.

2  –  Description

    The reentrant version of the getc macro is locked against
    multiple threads calling it simultaneously. This incurs overhead
    to ensure integrity of the stream. The unlocked version of this
    call, getc_unlocked can be used to avoid the overhead. The getc_
    unlocked macro is functionally identical to the getc macro,
    except that it is not required to be implemented in a thread-
    safe manner. The getc_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 getc_unlocked is used.

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

    See also flockfile, ftrylockfile, and funlockfile.

3  –  Return Values

    n                  The returned character.
    EOF                Indicates the end-of-file or an error.
Close Help