Rev 4874 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
Line 74... | Line 74... | ||
74 | if (fp == NULL) |
74 | if (fp == NULL) |
75 | return (0); /* on NULL */ |
75 | return (0); /* on NULL */ |
Line 76... | Line 76... | ||
76 | 76 | ||
Line -... | Line 77... | ||
- | 77 | CHECK_INIT (rptr, fp); |
|
- | 78 | ||
- | 79 | /* We can't use the _newlib_flockfile_XXX macros here due to the |
|
- | 80 | interlocked locking with the sfp_lock. */ |
|
- | 81 | #ifdef _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
|
- | 82 | int __oldcancel; |
|
77 | CHECK_INIT (rptr, fp); |
83 | pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &__oldcancel); |
Line 78... | Line 84... | ||
78 | 84 | #endif |
|
79 | _flockfile (fp); |
85 | _flockfile (fp); |
80 | 86 | ||
- | 87 | if (fp->_flags == 0) /* not open! */ |
|
- | 88 | { |
|
- | 89 | _funlockfile (fp); |
|
81 | if (fp->_flags == 0) /* not open! */ |
90 | #ifdef _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
82 | { |
91 | pthread_setcancelstate (__oldcancel, &__oldcancel); |
83 | _funlockfile (fp); |
92 | #endif |
84 | return (0); |
93 | return (0); |
85 | } |
94 | } |
Line 101... | Line 110... | ||
101 | #ifndef __SINGLE_THREAD__ |
110 | #ifndef __SINGLE_THREAD__ |
102 | __lock_close_recursive (fp->_lock); |
111 | __lock_close_recursive (fp->_lock); |
103 | #endif |
112 | #endif |
Line 104... | Line 113... | ||
104 | 113 | ||
- | 114 | __sfp_lock_release (); |
|
- | 115 | #ifdef _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
|
- | 116 | pthread_setcancelstate (__oldcancel, &__oldcancel); |
|
Line 105... | Line 117... | ||
105 | __sfp_lock_release (); |
117 | #endif |
106 | 118 | ||
Line 107... | Line 119... | ||
107 | return (r); |
119 | return (r); |