diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc index 159f4ae9f5e..22e9ac4685a 100644 --- a/cmd/traffic_manager/traffic_manager.cc +++ b/cmd/traffic_manager/traffic_manager.cc @@ -105,7 +105,7 @@ static void SignalHandler(int sig); static void SignalAlrmHandler(int sig); #endif -static std::atomic sigHupNotifier; +static std::atomic sigHupNotifier{0}; static void SigChldHandler(int sig); static void diff --git a/example/remap/remap.cc b/example/remap/remap.cc index e6600e6a308..cfc3d9b5439 100644 --- a/example/remap/remap.cc +++ b/example/remap/remap.cc @@ -212,8 +212,8 @@ TSRemapDeleteInstance(void *ih) delete ri; } -static std::atomic processing_counter; // sequential counter -static int arg_index; +static std::atomic processing_counter{0}; // sequential counter +static int arg_index = 0; /* -------------------------- TSRemapDoRemap -------------------------------- */ TSRemapStatus @@ -223,7 +223,7 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri) const char *temp2; int len, len2, port; TSMLoc cfield; - uint64_t _processing_counter = processing_counter++; + uint64_t _processing_counter = processing_counter.fetch_add(1) + 1; remap_entry *ri = (remap_entry *)ih; TSDebug(PLUGIN_NAME, "enter"); diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index c39a0d8306c..e80b719c8c6 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -87,12 +87,12 @@ int cache_config_compatibility_4_2_0_fixup = 1; // Globals -RecRawStatBlock *cache_rsb = nullptr; -Cache *theStreamCache = nullptr; -Cache *theCache = nullptr; -CacheDisk **gdisks = nullptr; -int gndisks = 0; -static int initialize_disk; +RecRawStatBlock *cache_rsb = nullptr; +Cache *theStreamCache = nullptr; +Cache *theCache = nullptr; +CacheDisk **gdisks = nullptr; +int gndisks = 0; +static int initialize_disk = 0; Cache *caches[NUM_CACHE_FRAG_TYPES] = {nullptr}; CacheSync *cacheDirSync = nullptr; Store theCacheStore; diff --git a/iocore/eventsystem/P_UnixEventProcessor.h b/iocore/eventsystem/P_UnixEventProcessor.h index 5ada1cd1168..d020854f8b3 100644 --- a/iocore/eventsystem/P_UnixEventProcessor.h +++ b/iocore/eventsystem/P_UnixEventProcessor.h @@ -25,6 +25,7 @@ #define _P_UnixEventProcessor_h_ #include "ts/ink_align.h" +#include "ts/ink_atomic.h" #include "I_EventProcessor.h" const int LOAD_BALANCE_INTERVAL = 1; diff --git a/iocore/eventsystem/test_Event.cc b/iocore/eventsystem/test_Event.cc index 2a0a3430d40..5723cb33871 100644 --- a/iocore/eventsystem/test_Event.cc +++ b/iocore/eventsystem/test_Event.cc @@ -23,6 +23,7 @@ #include "I_EventSystem.h" #include "ts/I_Layout.h" +#include "ts/ink_atomic.h" #include "diags.i" diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h index 188723bdc4a..ad688e35166 100644 --- a/lib/ts/Ptr.h +++ b/lib/ts/Ptr.h @@ -24,7 +24,7 @@ #ifndef PTR_H_FBBD7DC3_CA5D_4715_9162_5E4DDA93353F #define PTR_H_FBBD7DC3_CA5D_4715_9162_5E4DDA93353F -#include "ts/ink_atomic.h" +#include //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// @@ -64,14 +64,14 @@ class RefCountObj : public ForceVFPTToTop int refcount_inc() { - return ink_atomic_increment((int *)&m_refcount, 1) + 1; + return m_refcount.fetch_add(1) + 1; } // Decrement the reference count, returning the new count. int refcount_dec() { - return ink_atomic_increment((int *)&m_refcount, -1) - 1; + return m_refcount.fetch_sub(1) - 1; } int @@ -87,7 +87,7 @@ class RefCountObj : public ForceVFPTToTop } private: - int m_refcount; + std::atomic m_refcount; }; #define REF_COUNT_OBJ_REFCOUNT_INC(_x) (_x)->refcount_inc() @@ -164,7 +164,7 @@ template class Ptr detach() { T *tmp = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return tmp; } @@ -246,7 +246,7 @@ Ptr::clear() if (m_ptr) { if (!m_ptr->refcount_dec()) m_ptr->free(); - m_ptr = NULL; + m_ptr = nullptr; } } diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc index 7a249a445d4..06235e22434 100644 --- a/mgmt/ProcessManager.cc +++ b/mgmt/ProcessManager.cc @@ -99,7 +99,7 @@ ProcessManager::start(std::function const &cb) init = cb; ink_release_assert(running == 0); - ink_atomic_increment(&running, 1); + running.fetch_add(1); poll_thread = ink_thread_create(processManagerThread, nullptr, 0, 0, nullptr); } @@ -109,7 +109,7 @@ ProcessManager::stop() Debug("pmgmt", "stopping process manager"); ink_release_assert(running == 1); - ink_atomic_decrement(&running, 1); + running.fetch_sub(1); int tmp = local_manager_sockfd; diff --git a/mgmt/ProcessManager.h b/mgmt/ProcessManager.h index b622a7546b4..e6c58040983 100644 --- a/mgmt/ProcessManager.h +++ b/mgmt/ProcessManager.h @@ -41,6 +41,7 @@ #include "ts/ink_sock.h" #include "ts/ink_apidefs.h" +#include #include class ConfigUpdateCbTable; @@ -84,7 +85,7 @@ class ProcessManager : public BaseManager pid_t pid; ink_thread poll_thread = ink_thread_null(); - int running = 0; + std::atomic running{0}; /// Thread initialization callback. /// This allows @c traffic_server and @c traffic_manager to perform different initialization in the thread. diff --git a/mgmt/ProxyConfig.cc b/mgmt/ProxyConfig.cc index c90f950adb9..52e7f855582 100644 --- a/mgmt/ProxyConfig.cc +++ b/mgmt/ProxyConfig.cc @@ -127,7 +127,7 @@ ConfigProcessor::set(unsigned int id, ConfigInfo *info, unsigned timeout_secs) int idx; if (id == 0) { - id = ink_atomic_increment((int *)&ninfos, 1) + 1; + id = ninfos.fetch_add(1) + 1; ink_assert(id != 0); ink_assert(id <= MAX_CONFIGS); } @@ -147,7 +147,7 @@ ConfigProcessor::set(unsigned int id, ConfigInfo *info, unsigned timeout_secs) } idx = id - 1; - old_info = ink_atomic_swap(&infos[idx], info); + old_info = (infos[idx]).exchange(info); Debug("config", "Set for slot %d 0x%" PRId64 " was 0x%" PRId64 " with ref count %d", id, (int64_t)info, (int64_t)old_info, (old_info) ? old_info->refcount() : 0); @@ -214,7 +214,7 @@ enum { }; struct RegressionConfig : public ConfigInfo { - static int nobjects; // count of outstanding RegressionConfig objects (not-reentrant) + static std::atomic nobjects; // count of outstanding RegressionConfig objects (not-reentrant) // DeferredCall is a simple function call wrapper that defers itself until the RegressionConfig // object count drops below the specified count. @@ -251,7 +251,7 @@ struct RegressionConfig : public ConfigInfo { box.check(this->refcount() == 1, "invalid refcount %d (should be 1)", this->refcount()); } - ink_atomic_increment(&nobjects, 1); + nobjects.fetch_add(1); } ~RegressionConfig() override @@ -268,7 +268,7 @@ struct RegressionConfig : public ConfigInfo { box.check(*this->pstatus == REGRESSION_TEST_INPROGRESS, "intermediate config out of sequence, *pstatus is %d", *pstatus); } - ink_atomic_increment(&nobjects, -1); + nobjects.fetch_sub(1); } RegressionTest *test; @@ -276,7 +276,7 @@ struct RegressionConfig : public ConfigInfo { unsigned flags; }; -int RegressionConfig::nobjects = 0; +std::atomic RegressionConfig::nobjects{0}; struct ProxyConfig_Set_Completion { ProxyConfig_Set_Completion(int _id, RegressionConfig *_c) : configid(_id), config(_c) {} diff --git a/mgmt/ProxyConfig.h b/mgmt/ProxyConfig.h index 24ef5eb0f28..ed33eb32ea4 100644 --- a/mgmt/ProxyConfig.h +++ b/mgmt/ProxyConfig.h @@ -92,8 +92,8 @@ class ConfigProcessor void release(unsigned int id, ConfigInfo *data); public: - ConfigInfo *infos[MAX_CONFIGS]; - int ninfos; + std::atomic infos[MAX_CONFIGS]; + std::atomic ninfos; }; // A Continuation wrapper that calls the static reconfigure() method of the given class. diff --git a/plugins/background_fetch/configs.h b/plugins/background_fetch/configs.h index ab9bb891b6b..6ca17d04af6 100644 --- a/plugins/background_fetch/configs.h +++ b/plugins/background_fetch/configs.h @@ -25,10 +25,13 @@ #ifndef CONFIGS_H_DEBFCE23_D6E9_40C2_AAA5_32B32586A3DA #define CONFIGS_H_DEBFCE23_D6E9_40C2_AAA5_32B32586A3DA -#include +#include +#include +#include +#include +#include #include "rules.h" -#include "ts/ink_atomic.h" // Constants const char PLUGIN_NAME[] = "background_fetch"; @@ -43,14 +46,14 @@ class BgFetchConfig void acquire() { - ink_atomic_increment(&_ref_count, 1); + _ref_count.fetch_add(1); } void release() { - TSDebug(PLUGIN_NAME, "ref_count is %d", _ref_count); - if (1 >= ink_atomic_decrement(&_ref_count, 1)) { + TSDebug(PLUGIN_NAME, "ref_count is %d", (int)_ref_count); + if (1 >= _ref_count.fetch_sub(1)) { TSDebug(PLUGIN_NAME, "configuration deleted, due to ref-counting"); delete this; } @@ -82,7 +85,7 @@ class BgFetchConfig TSCont _cont; BgFetchRule *_rules; - int _ref_count; + std::atomic _ref_count; }; #endif /* CONFIGS_H_DEBFCE23_D6E9_40C2_AAA5_32B32586A3DA */ diff --git a/plugins/experimental/geoip_acl/lulu.h b/plugins/experimental/geoip_acl/lulu.h index ef97cce0a7c..c28005f58c9 100644 --- a/plugins/experimental/geoip_acl/lulu.h +++ b/plugins/experimental/geoip_acl/lulu.h @@ -26,7 +26,6 @@ #include #include "ts/ink_defs.h" -#include "ts/ink_atomic.h" // Used for Debug etc. static const char *PLUGIN_NAME = "geoip_acl"; diff --git a/plugins/experimental/memcache/tsmemcache.cc b/plugins/experimental/memcache/tsmemcache.cc index 40f9517f14e..49411db956f 100644 --- a/plugins/experimental/memcache/tsmemcache.cc +++ b/plugins/experimental/memcache/tsmemcache.cc @@ -39,9 +39,9 @@ ClassAllocator theMCAllocator("MC"); static time_t base_day_time; // These should be persistent. -int32_t MC::verbosity = 0; -ink_hrtime MC::last_flush = 0; -int64_t MC::next_cas = 1; +int32_t MC::verbosity = 0; +std::atomic MC::last_flush{0}; +std::atomic MC::next_cas{1}; static void tsmemcache_constants() @@ -444,7 +444,7 @@ MC::cache_read_event(int event, void *data) } { ink_hrtime t = Thread::get_hrtime(); - if (((ink_hrtime)rcache_header->settime) <= last_flush || + if (((ink_hrtime)rcache_header->settime) <= last_flush.load() || t >= ((ink_hrtime)rcache_header->settime) + HRTIME_SECONDS(rcache_header->exptime)) { goto Lfail; } @@ -777,7 +777,7 @@ MC::ascii_set_event(int event, void *data) goto Lfail; } ink_hrtime t = Thread::get_hrtime(); - if (((ink_hrtime)wcache_header->settime) <= last_flush || + if (((ink_hrtime)wcache_header->settime) <= last_flush.load() || t >= ((ink_hrtime)wcache_header->settime) + HRTIME_SECONDS(wcache_header->exptime)) { goto Lstale; } @@ -813,7 +813,7 @@ MC::ascii_set_event(int event, void *data) return ASCII_RESPONSE("EXISTS"); } } - header.cas = ink_atomic_increment(&next_cas, 1); + header.cas = next_cas.fetch_add(1); if (f.set_append || f.set_prepend) { header.nbytes = nbytes + rcache_header->nbytes; } else { @@ -937,7 +937,7 @@ MC::ascii_incr_decr_event(int event, void *data) goto Lfail; } ink_hrtime t = Thread::get_hrtime(); - if (((ink_hrtime)wcache_header->settime) <= last_flush || + if (((ink_hrtime)wcache_header->settime) <= last_flush.load() || t >= ((ink_hrtime)wcache_header->settime) + HRTIME_SECONDS(wcache_header->exptime)) { goto Lfail; } @@ -960,7 +960,7 @@ MC::ascii_incr_decr_event(int event, void *data) header.exptime = UINT32_MAX; // 136 years } } - header.cas = ink_atomic_increment(&next_cas, 1); + header.cas = next_cas.fetch_add(1); { char *data = 0; int len = 0; @@ -1385,11 +1385,7 @@ MC::read_ascii_from_client_event(int event, void *data) } f.noreply = is_noreply(&s, e); ink_hrtime new_last_flush = Thread::get_hrtime() + HRTIME_SECONDS(time_offset); -#if __WORDSIZE == 64 - last_flush = new_last_flush; // this will be atomic for native word size -#else - ink_atomic_swap(&last_flush, new_last_flush); -#endif + last_flush.store(new_last_flush); if (!is_end_of_cmd(s, e)) { break; } diff --git a/plugins/experimental/memcache/tsmemcache.h b/plugins/experimental/memcache/tsmemcache.h index af17e36e9fb..4422a11601b 100644 --- a/plugins/experimental/memcache/tsmemcache.h +++ b/plugins/experimental/memcache/tsmemcache.h @@ -24,6 +24,8 @@ #ifndef tsmemcache_h #define tsmemcache_h +#include + #include "I_EventSystem.h" #include "I_Net.h" #include "I_Cache.h" @@ -155,8 +157,8 @@ struct MC : Continuation { uint64_t delta; static int32_t verbosity; - static ink_hrtime last_flush; - static int64_t next_cas; + static std::atomic last_flush; + static std::atomic next_cas; int write_to_client(int64_t ntowrite = -1); int write_then_read_from_client(int64_t ntowrite = -1); diff --git a/plugins/gzip/configuration.h b/plugins/gzip/configuration.h index da184e06425..a197810c5b0 100644 --- a/plugins/gzip/configuration.h +++ b/plugins/gzip/configuration.h @@ -24,10 +24,10 @@ #ifndef GZIP_CONFIGURATION_H_ #define GZIP_CONFIGURATION_H_ +#include #include #include #include "debug_macros.h" -#include "ts/ink_atomic.h" namespace Gzip { @@ -123,12 +123,12 @@ class HostConfiguration void hold() { - ink_atomic_increment(&ref_count_, 1); + ref_count_++; } void release() { - if (1 >= ink_atomic_decrement(&ref_count_, 1)) { + if (1 >= ref_count_--) { debug("released and deleting HostConfiguration for %s settings", host_.size() > 0 ? host_.c_str() : "global"); delete this; } @@ -141,7 +141,7 @@ class HostConfiguration bool remove_accept_encoding_; bool flush_; int compression_algorithms_; - int ref_count_; + std::atomic ref_count_; StringContainer compressible_content_types_; StringContainer disallows_; diff --git a/plugins/header_rewrite/header_rewrite.cc b/plugins/header_rewrite/header_rewrite.cc index 27ad450d4bd..03dd12a2029 100644 --- a/plugins/header_rewrite/header_rewrite.cc +++ b/plugins/header_rewrite/header_rewrite.cc @@ -15,14 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. */ + +#include #include #include #include "ts/ts.h" #include "ts/remap.h" -#include "ts/ink_atomic.h" - #include "parser.h" #include "ruleset.h" #include "resources.h" @@ -98,12 +98,12 @@ class RulesConfig void hold() { - ink_atomic_increment(&_ref_count, 1); + _ref_count++; } void release() { - if (1 >= ink_atomic_decrement(&_ref_count, 1)) { + if (1 >= _ref_count--) { delete this; } } @@ -120,7 +120,7 @@ class RulesConfig bool add_rule(RuleSet *rule); TSCont _cont; - int _ref_count; + std::atomic _ref_count; RuleSet *_rules[TS_HTTP_LAST_HOOK + 1]; ResourceIDs _resids[TS_HTTP_LAST_HOOK + 1]; }; diff --git a/plugins/healthchecks/healthchecks.c b/plugins/healthchecks/healthchecks.c index 8e2b5314823..c880d236573 100644 --- a/plugins/healthchecks/healthchecks.c +++ b/plugins/healthchecks/healthchecks.c @@ -43,12 +43,6 @@ static const char SEPARATORS[] = " \t\n"; #define MAX_BODY_LEN 16384 #define FREELIST_TIMEOUT 300 -static inline void * -ink_atomic_swap_ptr(void *mem, void *value) -{ - return __sync_lock_test_and_set((void **)mem, value); -} - /* Directories that we are watching for inotify IN_CREATE events. */ typedef struct HCDirEntry_t { char dname[MAX_PATH_LEN]; /* Directory name */ @@ -245,7 +239,8 @@ hc_thread(void *data ATS_UNUSED) memset(new_data, 0, sizeof(HCFileData)); reload_status_file(finfo, new_data); TSDebug(PLUGIN_NAME, "Reloaded %s, len == %d, exists == %d", finfo->fname, new_data->b_len, new_data->exists); - old_data = ink_atomic_swap_ptr(&(finfo->data), new_data); + + old_data = __sync_lock_test_and_set(&(finfo->data), new_data); /* Add the old data to the head of the freelist */ old_data->remove = now.tv_sec + FREELIST_TIMEOUT; diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc index 6f2dd091365..d40d48b820e 100644 --- a/plugins/regex_remap/regex_remap.cc +++ b/plugins/regex_remap/regex_remap.cc @@ -37,10 +37,10 @@ #include #include #include +#include // Get some specific stuff from libts, yes, we can do that now that we build inside the core. #include "ts/ink_platform.h" -#include "ts/ink_atomic.h" #include "ts/ink_time.h" #include "ts/ink_inet.h" @@ -146,7 +146,7 @@ class RemapRegex void increment() { - ink_atomic_increment(&(_hits), 1); + _hits++; } void print(int ix, int max, const char *now) @@ -272,9 +272,9 @@ class RemapRegex char *_subst = nullptr; int _subst_len = 0; int _num_subs = -1; - int _hits = 0; - int _options = 0; - int _order = -1; + std::atomic _hits{0}; + int _options = 0; + int _order = -1; bool _lowercase_substitutions = false; @@ -664,8 +664,8 @@ struct RemapInstance { bool query_string; bool matrix_params; bool host; - int hits; - int misses; + std::atomic hits; + std::atomic misses; std::string filename; }; @@ -898,8 +898,8 @@ TSRemapDeleteInstance(void *ih) } fprintf(stderr, "[%s]: Profiling information for regex_remap file `%s':\n", now, (ri->filename).c_str()); - fprintf(stderr, "[%s]: Total hits (matches): %d\n", now, ri->hits); - fprintf(stderr, "[%s]: Total missed (no regex matches): %d\n", now, ri->misses); + fprintf(stderr, "[%s]: Total hits (matches): %d\n", now, (int)ri->hits); + fprintf(stderr, "[%s]: Total missed (no regex matches): %d\n", now, (int)ri->misses); if (ri->hits > 0) { // Avoid divide by zeros... int ix = 1; @@ -1058,7 +1058,7 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo *rri) // Update profiling if requested if (ri->profile) { re->increment(); - ink_atomic_increment(&(ri->hits), 1); + ri->hits++; } if (new_len > 0) { @@ -1105,7 +1105,7 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo *rri) if (re == nullptr) { retval = TSREMAP_NO_REMAP; // No match if (ri->profile) { - ink_atomic_increment(&(ri->misses), 1); + ri->misses++; } } } diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc index 40821824604..cad256a67e5 100644 --- a/plugins/s3_auth/s3_auth.cc +++ b/plugins/s3_auth/s3_auth.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -42,7 +43,6 @@ #include // Special snowflake here, only availbale when building inside the ATS source tree. -#include "ts/ink_atomic.h" #include "aws_auth_v4.h" /////////////////////////////////////////////////////////////////////////////// @@ -212,14 +212,14 @@ class S3Config void acquire() { - ink_atomic_increment(&_ref_count, 1); + _ref_count++; } void release() { - TSDebug(PLUGIN_NAME, "ref_count is %d", _ref_count); - if (1 >= ink_atomic_decrement(&_ref_count, 1)) { + TSDebug(PLUGIN_NAME, "ref_count is %d", static_cast(_ref_count)); + if (1 >= _ref_count--) { TSDebug(PLUGIN_NAME, "configuration deleted, due to ref-counting"); delete this; } @@ -397,7 +397,7 @@ class S3Config bool _version_modified = false; bool _virt_host_modified = false; TSCont _cont = nullptr; - int _ref_count = 1; + std::atomic _ref_count{1}; StringSet _v4includeHeaders; bool _v4includeHeaders_modified = false; StringSet _v4excludeHeaders; diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 7c417a25531..d01701a0cc7 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -83,11 +83,11 @@ _HDR.m_mime = _HDR.m_http->m_fields_impl; // Globals for new librecords stats -static int api_rsb_index; +static int api_rsb_index = 0; static RecRawStatBlock *api_rsb; // Globals for the Sessions/Transaction index registry -static int next_argv_index; +static int next_argv_index = 0; static std::type_info const &TYPE_INFO_MGMT_INT = typeid(MgmtInt); static std::type_info const &TYPE_INFO_MGMT_BYTE = typeid(MgmtByte); diff --git a/proxy/Main.cc b/proxy/Main.cc index 48eaf642d7d..2e0c5e6d6e5 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -170,7 +170,7 @@ static bool signal_received[NSIG]; // 1: delay listen, wait for cache. // 0: Do not delay, start listen ASAP. // -1: cache is already initialized, don't delay. -static int delay_listen_for_cache_p; +static int delay_listen_for_cache_p = 0; AppVersionInfo appVersionInfo; // Build info for this application diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc index 2ca4332ec2d..771d6f74567 100644 --- a/proxy/PluginVC.cc +++ b/proxy/PluginVC.cc @@ -1003,7 +1003,7 @@ PluginVC::set_data(int id, void *data) // PluginVCCore -int32_t PluginVCCore::nextid; +int32_t PluginVCCore::nextid = 0; PluginVCCore::~PluginVCCore() { diff --git a/proxy/StatPages.cc b/proxy/StatPages.cc index b98e9304821..5501657997c 100644 --- a/proxy/StatPages.cc +++ b/proxy/StatPages.cc @@ -44,7 +44,7 @@ static struct { StatPagesFunc func; } stat_pages[MAX_STAT_PAGES]; -static int n_stat_pages; +static int n_stat_pages = 0; void StatPagesManager::init() diff --git a/proxy/logging/LogBuffer.cc b/proxy/logging/LogBuffer.cc index 86b1344c5f9..474e3fa4696 100644 --- a/proxy/logging/LogBuffer.cc +++ b/proxy/logging/LogBuffer.cc @@ -55,7 +55,7 @@ enum { FieldListCacheElement fieldlist_cache[FIELDLIST_CACHE_SIZE]; int fieldlist_cache_entries = 0; -int32_t LogBuffer::M_ID; +int32_t LogBuffer::M_ID = 0; /*------------------------------------------------------------------------- The following LogBufferHeader routines are used to grab strings out from diff --git a/proxy/logging/LogBuffer.h b/proxy/logging/LogBuffer.h index c027419723f..70738b1eafd 100644 --- a/proxy/logging/LogBuffer.h +++ b/proxy/logging/LogBuffer.h @@ -25,6 +25,7 @@ #define LOG_BUFFER_H #include "ts/ink_platform.h" +#include "ts/ink_atomic.h" #include "ts/Diags.h" #include "LogFormat.h" #include "LogLimits.h"