1 /* 2 * Copyright 2003-2010 Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _STDIO_POST_H_ 6 #define _STDIO_POST_H_ 7 8 9 /* "Private"/inline functions of our BeOS compatible stdio implementation */ 10 11 /* ToDo: this is a work in progress to make our stdio 12 * BeOS' GNU/libio (almost) binary compatible 13 * We may not yet be compatible! */ 14 15 #ifndef _STDIO_H_ 16 # error "This file must be included from stdio.h!" 17 #endif 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 extern char _single_threaded; 24 /* this boolean value is true (1) if there is only the main thread 25 * running - as soon as you spawn the first thread, it's set to 26 * false (0) */ 27 28 #ifdef __cplusplus 29 } 30 #endif 31 32 #define getc(stream) \ 33 (_single_threaded ? getc_unlocked(stream) : getc(stream)) 34 #define putc(c, stream) \ 35 (_single_threaded ? putc_unlocked(c, stream) : putc(c, stream)) 36 37 #endif /* _STDIO_POST_H_ */ 38