https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162

--- Comment #6 from Konstantin Belousov <k...@freebsd.org> ---
(In reply to Victor Stinner from comment #5)
FreeBSD also ensures that both open(O_RDONLY) and open(O_WRONLY) succeed
simultaneously, but there is a race.

Assume that both threads doing the opens noticed each other presence, but right
after that the thread doing open(O_RDONLY) continued execution, while the
thread doing(O_WRONLY) was not put on the CPU immediately.  It was a scheduler
decision, for whatever reasons.  Then, open(O_RDONLY) succeeds, the thread
continues the execution and then it could even run as far as to execute close()
on the fd returned by open.  After that, when open(O_WRONLY) thread eventually
gets CPU, it notices that there is no readers (there was one, but it is gone
now).  So it returns to the sleep waiting for a reader.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to