From 44a44861605bec10432ecbb05b4201259d33aaec Mon Sep 17 00:00:00 2001 From: mutouyun Date: Sun, 11 Aug 2024 17:24:39 +0800 Subject: [PATCH] refactor: Add comments for dirty write cases --- include/libconcur/concurrent.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/libconcur/concurrent.h b/include/libconcur/concurrent.h index 64e5056..d3f8b0f 100644 --- a/include/libconcur/concurrent.h +++ b/include/libconcur/concurrent.h @@ -370,6 +370,7 @@ struct producer { auto w_cur = trunc_index(hdr, w_idx); auto &elem = elems[w_cur]; // Set data & flag. Dirty write is not considered here. + // By default, when dirty writes occur, the writing behavior itself must be atomic. elem.set_flag(w_idx | state::enqueue_mask); elem.set_data(std::forward(src)); elem.set_flag(w_idx);