projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix dup3 ignoring all flags but O_CLOEXEC on archs with SYS_dup2 syscall
[musl]
/
src
/
stdio
/
getc.h
diff --git
a/src/stdio/getc.h
b/src/stdio/getc.h
index
0657ab6
..
e24f990
100644
(file)
--- a/
src/stdio/getc.h
+++ b/
src/stdio/getc.h
@@
-4,9
+4,9
@@
#ifdef __GNUC__
__attribute__((__noinline__))
#endif
#ifdef __GNUC__
__attribute__((__noinline__))
#endif
-static int locking_getc(FILE *f
, int tid
)
+static int locking_getc(FILE *f)
{
{
- if (a_cas(&f->lock, 0,
tid
)) __lockfile(f);
+ if (a_cas(&f->lock, 0,
MAYBE_WAITERS-1
)) __lockfile(f);
int c = getc_unlocked(f);
if (a_swap(&f->lock, 0) & MAYBE_WAITERS)
__wake(&f->lock, 1, 1);
int c = getc_unlocked(f);
if (a_swap(&f->lock, 0) & MAYBE_WAITERS)
__wake(&f->lock, 1, 1);
@@
-15,8
+15,8
@@
static int locking_getc(FILE *f, int tid)
static inline int do_getc(FILE *f)
{
static inline int do_getc(FILE *f)
{
- int
tid,
l = f->lock;
- if (l < 0 ||
(l & ~MAYBE_WAITERS) == (tid=__pthread_self()->tid)
)
+ int l = f->lock;
+ if (l < 0 ||
l && (l & ~MAYBE_WAITERS) == __pthread_self()->tid
)
return getc_unlocked(f);
return getc_unlocked(f);
- return locking_getc(f
, tid
);
+ return locking_getc(f);
}
}