소스 검색

avoid setting FILE lock count when not using flockfile

for now this is just a tiny optimization, but later if we support
cancellation from __stdio_read and __stdio_write, it will be necessary
for the recusrive lock count to be zero in order for these functions
to know they are responsible for unlocking the FILE on cancellation.
Rich Felker 13 년 전
부모
커밋
ca52e34767
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/stdio/__lockfile.c

+ 1 - 1
src/stdio/__lockfile.c

@@ -8,7 +8,7 @@ int __lockfile(FILE *f)
 		return 0;
 	while ((owner = a_cas(&f->lock, 0, tid)))
 		__wait(&f->lock, &f->waiters, owner, 1);
-	return f->lockcount = 1;
+	return 1;
 }
 
 void __unlockfile(FILE *f)