Save and restore errno around FUTEX_WAIT futex(2) operations. While there
authorkettenis <kettenis@openbsd.org>
Sun, 13 Jun 2021 21:11:54 +0000 (21:11 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 13 Jun 2021 21:11:54 +0000 (21:11 +0000)
commit96f2311e04d3f1f278964710d74f358d01e32a15
tree6be6f9a7902902089e3de982f456d8914afb4744
parent2d87e9eed93ee96f624f346aae9df612b9462c04
Save and restore errno around FUTEX_WAIT futex(2) operations.  While there
remove the unused _wait() function in librthread such that we don't have to
add the save/restore sequence there.

Fixed building Python as a race with another thread unlocking a futex(2)
would make futex(2) set errno to EAGAIN which would confuse Python in
beleiving that readdir(2) failed instead of reaching the end of the
directory.

Spotted and tested by tb@
ok bluhm@
lib/libc/thread/synch.h
lib/librthread/synch.h