chenBright commented on code in PR #3541:
URL: https://github.com/apache/brpc/pull/3541#discussion_r4000002786


##########
src/bthread/task_group.h:
##########
@@ -259,6 +226,10 @@ friend class TaskControl;
         int64_t last_run_ns_and_type() const {
             return _last_run_ns_and_type;
         }
+        int64_t last_run_ns_and_type_atomic_load() const {
+            return ((butil::atomic<int64_t>*)&_last_run_ns_and_type)
+                ->load(butil::memory_order_relaxed);

Review Comment:
   Updated the two fields in `CPUTimeStat` to actual atomic members and removed 
the type-punning casts. Field accesses and explicit copy operations now use 
relaxed atomic loads/stores, while the `seqlock` remains responsible for 
cross-field snapshot consistency. Added tests covering copying, field updates, 
and concurrent snapshot consistency.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to