Relax memory order where possible

Former-commit-id: 3e996035ea1d5a40d02f84e916837a1d350b844b
This commit is contained in:
John Sully 2020-10-13 06:35:16 +00:00
parent 8c33983e57
commit f275456439

View File

@ -293,7 +293,7 @@ int prepareClientToWrite(client *c, bool fAsync) {
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
int _addReplyToBuffer(client *c, const char *s, size_t len, bool fAsync) { int _addReplyToBuffer(client *c, const char *s, size_t len, bool fAsync) {
if (c->flags & CLIENT_CLOSE_AFTER_REPLY) return C_OK; if (c->flags.load(std::memory_order_relaxed) & CLIENT_CLOSE_AFTER_REPLY) return C_OK;
fAsync = fAsync && !FCorrectThread(c); // Not async if we're on the right thread fAsync = fAsync && !FCorrectThread(c); // Not async if we're on the right thread
if (fAsync) if (fAsync)
@ -327,7 +327,7 @@ int _addReplyToBuffer(client *c, const char *s, size_t len, bool fAsync) {
} }
void _addReplyProtoToList(client *c, const char *s, size_t len) { void _addReplyProtoToList(client *c, const char *s, size_t len) {
if (c->flags & CLIENT_CLOSE_AFTER_REPLY) return; if (c->flags.load(std::memory_order_relaxed) & CLIENT_CLOSE_AFTER_REPLY) return;
AssertCorrectThread(c); AssertCorrectThread(c);
listNode *ln = listLast(c->reply); listNode *ln = listLast(c->reply);