Skip to content

Commit

Permalink
Fix data race in BufferedRuntimeExecutor (facebook#45512)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#45512

isBufferingEnabled_ can be read (by design) from multiple threads, but
it's not atomic. Make it so.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D59907026

fbshipit-source-id: ffce54a28404148b3e270fa90dfe850a334ca2f0
  • Loading branch information
Alexander Blom authored and facebook-github-bot committed Jul 18, 2024
1 parent fbcb8f6 commit a37534e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BufferedRuntimeExecutor {
void unsafeFlush();

RuntimeExecutor runtimeExecutor_;
bool isBufferingEnabled_;
std::atomic<bool> isBufferingEnabled_;
std::mutex lock_;
std::atomic<uint64_t> lastIndex_;
std::priority_queue<BufferedWork> queue_;
Expand Down

0 comments on commit a37534e

Please sign in to comment.