Hm. I'd rather this were done as a nicely-contained method. Ideally it'd also be integrated into the rest of Einhorn's process waiting and state tracking mechanisms.

To make that work, you'd probably need to track your own two-state state machine ("ready to upgrade", "waiting for upgrade sentinel"). One consequence of the integration is, in addition to not having to wait() yourself, Einhorn will be able to service requests while waiting for the upgrade sentinel to report back. Depending on your point of view, this may or may not be a good thing. (I *think* it's good; if you want your command to be delivered to the re-execed version you should wait on the upgrade.)