]> git.scottworley.com Git - tl-append/commitdiff
Also take flock locks
authorScott Worley <scottworley@scottworley.com>
Wed, 13 Sep 2023 21:56:30 +0000 (14:56 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 13 Sep 2023 22:11:59 +0000 (15:11 -0700)
There are two kinds of locks, so for interoperability, everyone has to
always take both kinds, to avoid the possibility of one client using one
kind and another client using another kind & missing each other.  :(

I wonder what order we're supposed to take them in?  If we don't all
agree, we get deadlocks!  Here, I take them in alphabetical order
(fcntl then flock), in the hope of this being a legible Schelling point.

The test harness does exercise the "take locks in the 'wrong' order" case.
It probably deadlocks with some tiny probability on heavily-loaded
systems.  Sorry.  If this hurts you, feel free to remove it.


No differences found