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