[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked Subroutines


stdio with explicit client locking.


Standard Library (libc.a)


#include <stdio.h>

int getc_unlocked (FILE * stream);
int getchar_unlocked (void);
int putc_unlocked (int c, FILE * stream);
int putchar_unlocked (int c);


Versions of the functions getc, getchar, putc, and putchar respectively named getc_unlocked, getchar_unlocked, putc_unlocked, and putchar_unlocked are provided which are functionally identical to the original versions with the exception that they are not required to be implemented in a thread-safe manner. They 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 of the flockfile or ftrylockfile functions.

Return Values

See getc, getchar, putc, and putchar.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) subroutine.

Related Information

The getc or getchar (getc, getchar, fgetc, or getw Subroutine) subroutine, putc or putchar (putc, putchar, fputc, or putw Subroutine) subroutine.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]