mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 17:27:56 +00:00
This change switches most of the core locks to be re-entrant, in order to reduce the chance of deadlocking code that does, clever things with asynchronous signal handlers. This change implements it it in pthreads so we're one step closer to having a standardized threading primitives
23 lines
535 B
C
23 lines
535 B
C
#ifndef COSMOPOLITAN_LIBC_STDIO_FFLUSH_H_
|
|
#define COSMOPOLITAN_LIBC_STDIO_FFLUSH_H_
|
|
#include "libc/intrin/pthread.h"
|
|
#include "libc/stdio/stdio.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
struct StdioFlushHandles {
|
|
size_t i, n;
|
|
FILE **p;
|
|
};
|
|
|
|
struct StdioFlush {
|
|
pthread_mutex_t lock;
|
|
struct StdioFlushHandles handles;
|
|
FILE *handles_initmem[8];
|
|
};
|
|
|
|
hidden extern struct StdioFlush __fflush;
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_STDIO_FFLUSH_H_ */
|