From: Scott Worley Date: Wed, 13 Sep 2023 21:56:30 +0000 (-0700) Subject: Also take flock locks X-Git-Tag: v1.0.0~3 X-Git-Url: http://git.scottworley.com/tl-append/commitdiff_plain/d212cd99e7ef72e0add4ef772e328835a972ae6b?hp=d212cd99e7ef72e0add4ef772e328835a972ae6b Also take flock locks 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. ---