diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h index ba6fecd812d..0948601d0ed 100644 --- a/iocore/cache/P_CacheHosting.h +++ b/iocore/cache/P_CacheHosting.h @@ -152,7 +152,7 @@ class CacheHostTable struct CacheHostTableConfig; typedef int (CacheHostTableConfig::*CacheHostTabHandler)(int, void *); struct CacheHostTableConfig : public Continuation { - CacheHostTable **ppt; + std::atomic ppt; CacheHostTableConfig(CacheHostTable **appt) : Continuation(nullptr), ppt(appt) { SET_HANDLER((CacheHostTabHandler)&CacheHostTableConfig::mainEvent); @@ -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; new_Deleter(old, CACHE_MEM_FREE_TIMEOUT); return EVENT_DONE; }