Refactor ShutdownSocketSet atomic state machine
authorYedidya Feldblum <yfeldblum@fb.com>
Tue, 17 Oct 2017 23:09:36 +0000 (16:09 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 17 Oct 2017 23:30:22 +0000 (16:30 -0700)
commita25c5a91f3e0e5b60e43fdf2f1542649996bdcbf
tree5b78311f1211104a31529e908f9817edee004710
parent9917cdab81a12f1a06dbefc811f782d1cf76c7e3
Refactor ShutdownSocketSet atomic state machine

Summary:
[Folly] Refactor `ShutdownSocketSet` atomic state machine.

* Format.
* Use `while` over `goto`.
* Avoid `memory_order_acq_rel` as the single-argument memory order; some platforms fail to build that.
* Use `memory_order_relaxed` for all atomic operations because stronger memory orders are not actually required: the atomic state never serves as a barrier for synchronizing loads and stores of associated data because there is no associated data.

Reviewed By: davidtgoldblatt

Differential Revision: D6058292

fbshipit-source-id: d45d7fcfa472e6e393a5f980e75ad9ea3358bab3
folly/io/ShutdownSocketSet.cpp
folly/io/ShutdownSocketSet.h