Next: puts, Previous: putchar, Up: Stdio [Contents][Index]

### 4.48 `putchar_unlocked`—non-thread-safe version of putchar (macro)

Synopsis

    #include <stdio.h>
    int putchar_unlocked(int ch);

Description
`putchar_unlocked` is a non-thread-safe version of `putchar` declared in `stdio.h`. `putchar_unlocked` may only safely be used within a scope protected by flockfile() (or ftrylockfile()) and funlockfile(). These functions may safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the ( FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. If threads are disabled, then `putchar_unlocked` is equivalent to `putchar`.

Returns
See `putchar`.

Portability
POSIX 1003.1 requires `putchar_unlocked`. `putchar_unlocked` may be implemented as a macro.

Supporting OS subroutines required: `close`, `fstat`, `isatty`, `lseek`, `read`, `sbrk`, `write`.