You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/08/15 16:25:55 UTC
[GitHub] [trafficserver] rob05c commented on a diff in pull request #8664: fix hosting.config reload
rob05c commented on code in PR #8664:
URL: https://github.com/apache/trafficserver/pull/8664#discussion_r945923113
##########
iocore/cache/P_CacheHosting.h:
##########
@@ -163,8 +163,9 @@ struct CacheHostTableConfig : public Continuation {
{
(void)e;
(void)event;
- CacheHostTable *t = new CacheHostTable((*ppt)->cache, (*ppt)->type);
- CacheHostTable *old = (CacheHostTable *)ink_atomic_swap(&t, *ppt);
+ CacheHostTable *t = new CacheHostTable((*ppt)->cache, (*ppt)->type);
+ auto old = *ppt;
+ (*ppt) = t;
Review Comment:
I think this needs to be a `std::atomic<CacheHostTable *>* ppt` or possibly `std::atomic<std::atomic<CacheHostTable *>*> ppt;`.
With the outer pointer-pointer being atomic, but not the inner, I believe in `auto old = *ppt; the dereference `*ppt` will be atomic, but not the assignment to `old`. Likewise, in `(*ppt) = t;` I believe the `*ppt` dereference will be atomic, but when it takes `t` and assigns it to the value-pointer-to-by `ppt`, I don't think that will be atomic.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org