diff options
author | Eric Andersen <andersen@codepoet.org> | 2006-12-06 22:41:21 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2006-12-06 22:41:21 +0000 |
commit | 99d6c367c4820a072dc4ada51561df17e2093778 (patch) | |
tree | 969945da0bce7248de98eefedaeb590f5cfdd85e /libc/stdio/_stdio.c | |
parent | aeba32a371882d602f6863320880f0c69c824b77 (diff) |
stdio update from mjn3
Diffstat (limited to 'libc/stdio/_stdio.c')
-rw-r--r-- | libc/stdio/_stdio.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 6c96d8660..c406792d7 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -154,8 +154,12 @@ FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ FILE *_stdio_openlist = _stdio_streams; # ifdef __UCLIBC_HAS_THREADS__ -pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -int _stdio_openlist_delflag = 0; +pthread_mutex_t _stdio_openlist_add_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +#ifdef __STDIO_BUFFERS +pthread_mutex_t _stdio_openlist_del_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +volatile int _stdio_openlist_use_count = 0; +int _stdio_openlist_del_count = 0; +#endif # endif #endif @@ -187,7 +191,11 @@ void attribute_hidden _stdio_term(void) * locked, then I suppose there is a chance that a pointer in the * chain might be corrupt due to a partial store. */ - __stdio_init_mutex(&_stdio_openlist_lock); + __stdio_init_mutex(&_stdio_openlist_add_lock); +#warning check +#ifdef __STDIO_BUFFERS + __stdio_init_mutex(&_stdio_openlist_del_lock); +#endif /* Next we need to worry about the streams themselves. If a stream * is currently locked, then it may be in an invalid state. So we @@ -195,7 +203,7 @@ void attribute_hidden _stdio_term(void) * Then we reinitialize the locks. */ for (ptr = _stdio_openlist ; ptr ; ptr = ptr->__nextopen ) { - if (__STDIO_ALWAYS_THREADTRYLOCK(ptr)) { + if (__STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(ptr)) { /* The stream is already locked, so we don't want to touch it. * However, if we have custom streams, we can't just close it * or leave it locked since a custom stream may be stacked |