trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [trafficserver] 33/33: TS-4425: Use Ptr<ProxyMutex> for the Thread mutex.
Date Wed, 11 May 2016 20:31:57 GMT
This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 64b4092e01982e6daf8c006a57350f0f65030686
Author: James Peach <jpeach@apache.org>
AuthorDate: Sat May 7 15:03:05 2016 -0700

    TS-4425: Use Ptr<ProxyMutex> for the Thread mutex.
    
    Each Thread owns its own mutex, so declare this as a Ptr<ProxyMutex>
    to ensure that refcounting semantics are correctly preserved.
---
 iocore/cache/Cache.cc                |  2 +-
 iocore/cache/CacheWrite.cc           | 10 +++++-----
 iocore/cache/P_CacheInternal.h       |  2 +-
 iocore/cluster/ClusterCache.cc       | 10 +++++-----
 iocore/cluster/ClusterConfig.cc      |  5 ++---
 iocore/cluster/ClusterHandlerBase.cc |  2 +-
 iocore/cluster/ClusterMachine.cc     |  6 ++----
 iocore/cluster/ClusterProcessor.cc   |  6 +++---
 iocore/cluster/ClusterRPC.cc         | 10 +++++-----
 iocore/dns/DNS.cc                    |  8 ++++----
 iocore/eventsystem/I_IOBuffer.h      |  5 -----
 iocore/eventsystem/I_Thread.h        |  2 +-
 iocore/hostdb/HostDB.cc              | 12 ++++++------
 iocore/net/P_UnixNet.h               |  4 ++--
 iocore/net/UnixNet.cc                |  9 +++++----
 iocore/net/UnixNetProcessor.cc       |  2 +-
 iocore/net/UnixNetVConnection.cc     |  8 ++++----
 mgmt/ProxyConfig.h                   |  4 ++--
 proxy/ICP.cc                         |  2 +-
 proxy/ICPConfig.cc                   |  2 +-
 proxy/InkAPIInternal.h               |  2 +-
 proxy/InkIOCoreAPI.cc                |  2 +-
 proxy/logging/Log.cc                 |  6 +++---
 proxy/logging/LogFile.cc             |  4 ++--
 proxy/logging/LogObject.cc           |  2 +-
 25 files changed, 60 insertions(+), 67 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index d916d63..e074fc1 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -888,7 +888,7 @@ CacheProcessor::cacheInitialized()
   uint64_t vol_used_direntries = 0;
   Vol *vol;
 
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
 
   if (theCache) {
     total_size += theCache->cache_size;
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index af69c07..67391ed 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -364,7 +364,7 @@ CacheVC *
 new_DocEvacuator(int nbytes, Vol *vol)
 {
   CacheVC *c = new_CacheVC(vol);
-  ProxyMutex *mutex = vol->mutex;
+  ProxyMutex *mutex = vol->mutex.get();
   c->base_stat = cache_evacuate_active_stat;
   CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
   c->buf = new_IOBufferData(iobuffer_size_to_index(nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
@@ -802,7 +802,7 @@ agg_copy(char *p, CacheVC *vc)
     // move data
     if (vc->write_len) {
       {
-        ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex;
+        ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex.get();
         ink_assert(mutex->thread_holding == this_ethread());
         CACHE_DEBUG_SUM_DYN_STAT(cache_write_bytes_stat, vc->write_len);
       }
@@ -841,7 +841,7 @@ agg_copy(char *p, CacheVC *vc)
     Doc *doc = (Doc *)vc->buf->data();
     int l = vc->vol->round_to_approx_size(doc->len);
     {
-      ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex;
+      ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex.get();
       ink_assert(mutex->thread_holding == this_ethread());
       CACHE_DEBUG_INCREMENT_DYN_STAT(cache_gc_frags_evacuated_stat);
       CACHE_DEBUG_SUM_DYN_STAT(cache_gc_bytes_evacuated_stat, l);
@@ -1583,7 +1583,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheFragType
frag_ty
 
   intptr_t res = 0;
   CacheVC *c = new_CacheVC(cont);
-  ProxyMutex *mutex = cont->mutex;
+  ProxyMutex *mutex = cont->mutex.get();
   SCOPED_MUTEX_LOCK(lock, c->mutex, this_ethread());
   c->vio.op = VIO::WRITE;
   c->base_stat = cache_write_active_stat;
@@ -1651,7 +1651,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo
*info,
   intptr_t err = 0;
   int if_writers = (uintptr_t)info == CACHE_ALLOW_MULTIPLE_WRITES;
   CacheVC *c = new_CacheVC(cont);
-  ProxyMutex *mutex = cont->mutex;
+  ProxyMutex *mutex = cont->mutex.get();
   c->vio.op = VIO::WRITE;
   c->first_key = *key;
   /*
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 7fd3162..4150ae6 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -879,7 +879,7 @@ dir_overwrite_lock(CacheKey *key, Vol *d, Dir *to_part, ProxyMutex *m,
Dir *over
 }
 
 void TS_INLINE
-rand_CacheKey(CacheKey *next_key, ProxyMutex *mutex)
+rand_CacheKey(CacheKey *next_key, Ptr<ProxyMutex> &mutex)
 {
   next_key->b[0] = mutex->thread_holding->generator.random();
   next_key->b[1] = mutex->thread_holding->generator.random();
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index 04213c9..2102a0d 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -243,7 +243,7 @@ ClusterVConnectionCache::insert(INK_MD5 *key, ClusterVConnection *vc)
   int index = MD5ToIndex(key);
   Entry *e;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   MUTEX_TRY_LOCK(lock, hash_lock[index], thread);
   if (!lock.is_locked()) {
@@ -269,7 +269,7 @@ ClusterVConnectionCache::lookup(INK_MD5 *key)
   Entry *e;
   ClusterVConnection *vc = 0;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   MUTEX_TRY_LOCK(lock, hash_lock[index], thread);
   if (!lock.is_locked()) {
@@ -1023,7 +1023,7 @@ void
 cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ////////////////////////////////////////////////////////
   // Note: we are running on the ET_CLUSTER thread
   ////////////////////////////////////////////////////////
@@ -1939,7 +1939,7 @@ cache_op_result_ClusterFunction(ClusterHandler *ch, void *d, int l)
 
   unsigned int hash = FOLDHASH(ch->machine->ip, msg->seq_number);
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   if (MUTEX_TAKE_TRY_LOCK(remoteCacheContQueueMutex[hash], thread)) {
     // Find it in pending list
 
@@ -2504,7 +2504,7 @@ cache_lookup_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
   (void)len;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ////////////////////////////////////////////////////////
   // Note: we are running on the ET_CLUSTER thread
   ////////////////////////////////////////////////////////
diff --git a/iocore/cluster/ClusterConfig.cc b/iocore/cluster/ClusterConfig.cc
index 499550b..39e6f75 100644
--- a/iocore/cluster/ClusterConfig.cc
+++ b/iocore/cluster/ClusterConfig.cc
@@ -285,7 +285,7 @@ configuration_add_machine(ClusterConfiguration *c, ClusterMachine *m)
   // Machines are stored in ip sorted order.
   //
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   int i = 0;
   ClusterConfiguration *cc = new ClusterConfiguration(*c);
 
@@ -321,8 +321,7 @@ configuration_add_machine(ClusterConfiguration *c, ClusterMachine *m)
 ClusterConfiguration *
 configuration_remove_machine(ClusterConfiguration *c, ClusterMachine *m)
 {
-  EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = this_thread()->mutex.get();
 
   //
   // Build a new cluster configuration without a machine
diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc
index cb7064c..41e3ab8 100644
--- a/iocore/cluster/ClusterHandlerBase.cc
+++ b/iocore/cluster/ClusterHandlerBase.cc
@@ -67,7 +67,7 @@ ClusterControl::ClusterControl()
 void
 ClusterControl::real_alloc_data(int read_access, bool align_int32_on_non_int64_boundary)
 {
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
 
   ink_assert(!data);
   if ((len + DATA_HDR + sizeof(int32_t)) <= DEFAULT_MAX_BUFFER_SIZE) {
diff --git a/iocore/cluster/ClusterMachine.cc b/iocore/cluster/ClusterMachine.cc
index 3dd80e8..4663f06 100644
--- a/iocore/cluster/ClusterMachine.cc
+++ b/iocore/cluster/ClusterMachine.cc
@@ -78,8 +78,7 @@ ClusterMachine::ClusterMachine(char *ahostname, unsigned int aip, int aport)
     msg_proto_minor(0),
     clusterHandlers(0)
 {
-  EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_MACHINES_ALLOCATED_STAT);
   if (!aip) {
     char localhost[1024];
@@ -191,8 +190,7 @@ struct MachineTimeoutContinuation : public Continuation {
 void
 free_ClusterMachine(ClusterMachine *m)
 {
-  EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
   // delay before the final free
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_MACHINES_FREED_STAT);
   m->dead = true;
diff --git a/iocore/cluster/ClusterProcessor.cc b/iocore/cluster/ClusterProcessor.cc
index 699d09c..89f4cf2 100644
--- a/iocore/cluster/ClusterProcessor.cc
+++ b/iocore/cluster/ClusterProcessor.cc
@@ -53,7 +53,7 @@ ClusterProcessor::~ClusterProcessor()
 int
 ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn, void *data,
int len, int options, void *cmsg)
 {
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
   //
   // RPC facility for intercluster communication available to other
   //  subsystems.
@@ -238,7 +238,7 @@ ClusterProcessor::open_local(Continuation *cont, ClusterMachine * /* m
ATS_UNUSE
     return NULL;
 
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ClusterVConnection *vc = clusterVCAllocator.alloc();
   vc->new_connect_read = (options & CLUSTER_OPT_CONN_READ ? 1 : 0);
   vc->start_time = Thread::get_hrtime();
@@ -308,7 +308,7 @@ ClusterProcessor::connect_local(Continuation *cont, ClusterVCToken *token,
int c
     return NULL;
 
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ClusterVConnection *vc = clusterVCAllocator.alloc();
   vc->new_connect_read = (options & CLUSTER_OPT_CONN_READ ? 1 : 0);
   vc->start_time = Thread::get_hrtime();
diff --git a/iocore/cluster/ClusterRPC.cc b/iocore/cluster/ClusterRPC.cc
index 8ae28c8..52c6724 100644
--- a/iocore/cluster/ClusterRPC.cc
+++ b/iocore/cluster/ClusterRPC.cc
@@ -132,7 +132,7 @@ CacheVC *
 ChannelToCacheWriteVC(ClusterHandler *ch, int channel, uint32_t channel_seqno, ClusterVConnection
**cluster_vc)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   ClusterVConnection *cvc = ch->channels[channel];
   if (!VALID_CHANNEL(cvc) || (channel_seqno != cvc->token.sequence_number) || (cvc->read.vio.op
!= VIO::READ)) {
@@ -160,7 +160,7 @@ void
 set_channel_data_ClusterFunction(ClusterHandler *ch, void *tdata, int tlen)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   // We are called on the ET_CLUSTER thread.
 
   char *data;
@@ -229,7 +229,7 @@ void
 post_setchan_send_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   // We are called on the ET_CLUSTER thread.
   // set_data() control message has been queued into cluster transfer message.
   // This allows us to assume that it has been sent.
@@ -289,7 +289,7 @@ void
 post_setchan_pin_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   // We are called on the ET_CLUSTER thread.
   // Control message has been queued into cluster transfer message.
   // This allows us to assume that it has been sent.
@@ -349,7 +349,7 @@ void
 post_setchan_priority_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED
*/)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   // We are called on the ET_CLUSTER thread.
   // Control message has been queued into cluster transfer message.
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index 02e65d4..63341f6 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -874,7 +874,7 @@ get_entry(DNSHandler *h, char *qname, int qtype)
 static void
 write_dns(DNSHandler *h)
 {
-  ProxyMutex *mutex = h->mutex;
+  ProxyMutex *mutex = h->mutex.get();
   DNS_INCREMENT_DYN_STAT(dns_total_lookups_stat);
   int max_nscount = h->m_res->nscount;
   if (max_nscount > MAX_NAMED)
@@ -955,7 +955,7 @@ DNSHandler::get_query_id()
 static bool
 write_dns_event(DNSHandler *h, DNSEntry *e)
 {
-  ProxyMutex *mutex = h->mutex;
+  ProxyMutex *mutex = h->mutex.get();
   union {
     HEADER _h;
     char _b[MAX_DNS_PACKET_LEN];
@@ -1110,7 +1110,7 @@ DNSProcessor::getby(const char *x, int len, int type, Continuation *cont,
Option
 static void
 dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry)
 {
-  ProxyMutex *mutex = h->mutex;
+  ProxyMutex *mutex = h->mutex.get();
   bool cancelled = (e->action.cancelled ? true : false);
 
   if (!ent && !cancelled) {
@@ -1279,7 +1279,7 @@ DNSEntry::postEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED
*/)
 static bool
 dns_process(DNSHandler *handler, HostEnt *buf, int len)
 {
-  ProxyMutex *mutex = handler->mutex;
+  ProxyMutex *mutex = handler->mutex.get();
   HEADER *h = (HEADER *)(buf->buf);
   DNSEntry *e = get_dns(handler, (uint16_t)ntohs(h->id));
   bool retry = false;
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index b50dfb2..17c61ad 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -1318,11 +1318,6 @@ public:
     return new_IOBufferBlock_internal(loc);
   }
   IOBufferBlock *
-  operator()(IOBufferData *d, int64_t len = 0, int64_t offset = 0)
-  {
-    return new_IOBufferBlock_internal(loc, d, len, offset);
-  }
-  IOBufferBlock *
   operator()(Ptr<IOBufferData> &d, int64_t len = 0, int64_t offset = 0)
   {
     return new_IOBufferBlock_internal(loc, d.get(), len, offset);
diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index f24bb99..eb4bc81 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -110,7 +110,7 @@ public:
     regions. Do not modify this member directly.
 
   */
-  ProxyMutex *mutex;
+  Ptr<ProxyMutex> mutex;
 
   // PRIVATE
   void set_specific();
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 2eabe2a..78de0bb 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -754,7 +754,7 @@ HostDBProcessor::getby(Continuation *cont, const char *hostname, int len,
sockad
 {
   HostDBMD5 md5;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ip_text_buffer ipb;
 
   HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
@@ -840,7 +840,7 @@ HostDBProcessor::getbyname_re(Continuation *cont, const char *ahostname,
int len
 {
   bool force_dns = false;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
     force_dns = true;
@@ -857,7 +857,7 @@ HostDBProcessor::getbynameport_re(Continuation *cont, const char *ahostname,
int
 {
   bool force_dns = false;
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
     force_dns = true;
@@ -879,7 +879,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation *cont, process_srv_info_pfn
proce
   ink_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
   EThread *thread = cont->mutex->thread_holding;
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
     force_dns = true;
@@ -952,7 +952,7 @@ HostDBProcessor::getbyname_imm(Continuation *cont, process_hostdb_info_pfn
proce
   ink_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
   EThread *thread = cont->mutex->thread_holding;
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   HostDBMD5 md5;
 
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
@@ -1022,7 +1022,7 @@ HostDBProcessor::iterate(Continuation *cont)
 {
   ink_assert(cont->mutex->thread_holding == this_ethread());
   EThread *thread = cont->mutex->thread_holding;
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
 
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 637577c..d7ae246 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -160,8 +160,8 @@ struct PollCont : public Continuation {
   PollDescriptor *nextPollDescriptor;
   int poll_timeout;
 
-  PollCont(ProxyMutex *m, int pt = net_config_poll_timeout);
-  PollCont(ProxyMutex *m, NetHandler *nh, int pt = net_config_poll_timeout);
+  PollCont(Ptr<ProxyMutex> &m, int pt = net_config_poll_timeout);
+  PollCont(Ptr<ProxyMutex> &m, NetHandler *nh, int pt = net_config_poll_timeout);
   ~PollCont();
   int pollEvent(int event, Event *e);
 };
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 5066b47..738b962 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -42,7 +42,7 @@ int update_cop_config(const char *name, RecDataT data_type, RecData data,
void *
 class InactivityCop : public Continuation
 {
 public:
-  InactivityCop(ProxyMutex *m) : Continuation(m), default_inactivity_timeout(0)
+  explicit InactivityCop(Ptr<ProxyMutex> &m) : Continuation(m.get()), default_inactivity_timeout(0)
   {
     SET_HANDLER(&InactivityCop::check_inactivity);
     REC_ReadConfigInteger(default_inactivity_timeout, "proxy.config.net.default_inactivity_timeout");
@@ -138,14 +138,15 @@ update_cop_config(const char *name, RecDataT data_type ATS_UNUSED, RecData
data,
 
 #endif
 
-PollCont::PollCont(ProxyMutex *m, int pt) : Continuation(m), net_handler(NULL), nextPollDescriptor(NULL),
poll_timeout(pt)
+PollCont::PollCont(Ptr<ProxyMutex> &m, int pt)
+  : Continuation(m.get()), net_handler(NULL), nextPollDescriptor(NULL), poll_timeout(pt)
 {
   pollDescriptor = new PollDescriptor();
   SET_HANDLER(&PollCont::pollEvent);
 }
 
-PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt)
-  : Continuation(m), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
+PollCont::PollCont(Ptr<ProxyMutex> &m, NetHandler *nh, int pt)
+  : Continuation(m.get()), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
 {
   pollDescriptor = new PollDescriptor();
   SET_HANDLER(&PollCont::pollEvent);
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index 841efc0..a7cb2a5 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -85,7 +85,7 @@ Action *
 UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions const &opt)
 {
   EventType upgraded_etype = opt.etype; // setEtype requires non-const ref.
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
   int accept_threads = opt.accept_threads; // might be changed.
   IpEndpoint accept_ip;                    // local binding address.
   char thr_name[MAX_THREAD_NAME_LENGTH];
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 899887a..a3e4355 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -253,7 +253,7 @@ static void
 read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
 {
   NetState *s = &vc->read;
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   int64_t r = 0;
 
   MUTEX_TRY_LOCK_FOR(lock, s->vio.mutex, thread, s->vio._cont);
@@ -416,7 +416,7 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
 void
 write_to_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
 {
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   NET_INCREMENT_DYN_STAT(net_calls_to_writetonet_stat);
   NET_INCREMENT_DYN_STAT(net_calls_to_writetonet_afterpoll_stat);
@@ -428,7 +428,7 @@ void
 write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
 {
   NetState *s = &vc->write;
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   MUTEX_TRY_LOCK_FOR(lock, s->vio.mutex, thread, s->vio._cont);
 
@@ -1012,7 +1012,7 @@ UnixNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted,
       }
     }
 
-    ProxyMutex *mutex = thread->mutex;
+    ProxyMutex *mutex = thread->mutex.get();
     NET_INCREMENT_DYN_STAT(net_calls_to_write_stat);
   } while (r == wattempted && total_written < towrite);
 
diff --git a/mgmt/ProxyConfig.h b/mgmt/ProxyConfig.h
index b3a35a5..9247b3b 100644
--- a/mgmt/ProxyConfig.h
+++ b/mgmt/ProxyConfig.h
@@ -104,12 +104,12 @@ template <typename UpdateClass> struct ConfigUpdateContinuation
: public Continu
     return EVENT_DONE;
   }
 
-  ConfigUpdateContinuation(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&ConfigUpdateContinuation::update);
}
+  ConfigUpdateContinuation(Ptr<ProxyMutex> &m) : Continuation(m.get()) { SET_HANDLER(&ConfigUpdateContinuation::update);
}
 };
 
 template <typename UpdateClass>
 int
-ConfigScheduleUpdate(ProxyMutex *mutex)
+ConfigScheduleUpdate(Ptr<ProxyMutex> &mutex)
 {
   eventProcessor.schedule_imm(new ConfigUpdateContinuation<UpdateClass>(mutex), ET_CALL);
   return 0;
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 3a48cb3..52602d6 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -1821,7 +1821,7 @@ ICPProcessor::ICPQuery(Continuation *c, URL *url)
 
   // Build continuation to process ICP request
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
   ICPRequestCont *rc = new (ICPRequestCont_allocator.alloc()) ICPRequestCont(this, c, url);
 
   ICP_INCREMENT_DYN_STAT(icp_query_requests_stat);
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index d3f12fa..f0a682b 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -518,7 +518,7 @@ void *
 ICPConfiguration::icp_config_change_callback(void *data, void *value, int startup)
 {
   EThread *thread = this_ethread();
-  ProxyMutex *mutex = thread->mutex;
+  ProxyMutex *mutex = thread->mutex.get();
 
   //
   // Cast passed parameters to correct types
diff --git a/proxy/InkAPIInternal.h b/proxy/InkAPIInternal.h
index 7908d1f..06c4d1c 100644
--- a/proxy/InkAPIInternal.h
+++ b/proxy/InkAPIInternal.h
@@ -299,7 +299,7 @@ class LifecycleAPIHooks : public FeatureAPIHooks<TSLifecycleHookID,
TS_LIFECYCLE
 class ConfigUpdateCallback : public Continuation
 {
 public:
-  ConfigUpdateCallback(INKContInternal *contp) : Continuation(contp->mutex), m_cont(contp)
+  ConfigUpdateCallback(INKContInternal *contp) : Continuation(contp->mutex.get()), m_cont(contp)
   {
     SET_HANDLER(&ConfigUpdateCallback::event_handler);
   }
diff --git a/proxy/InkIOCoreAPI.cc b/proxy/InkIOCoreAPI.cc
index cdd274f..cf0f4e8 100644
--- a/proxy/InkIOCoreAPI.cc
+++ b/proxy/InkIOCoreAPI.cc
@@ -338,7 +338,7 @@ TSVIOMutexGet(TSVIO viop)
   sdk_assert(sdk_sanity_check_iocore_structure(viop) == TS_SUCCESS);
 
   VIO *vio = (VIO *)viop;
-  return (TSMutex)((ProxyMutex *)vio->mutex);
+  return (TSMutex)(vio->mutex.get());
 }
 
 /* High Resolution Time */
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 636610a..fd80cfb 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1005,7 +1005,7 @@ Log::access(LogAccess *lad)
   int ret;
   static long sample = 1;
   long this_sample;
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
 
   // See if we're sampling and it is not time for another sample
   //
@@ -1061,7 +1061,7 @@ int
 Log::va_error(const char *format, va_list ap)
 {
   int ret_val = Log::SKIP;
-  ProxyMutex *mutex = this_ethread()->mutex;
+  ProxyMutex *mutex = this_ethread()->mutex.get();
 
   if (error_log) {
     ink_assert(format != NULL);
@@ -1196,7 +1196,7 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
   ink_hrtime now, last_time = 0;
   int len, total_bytes;
   SLL<LogFlushData, LogFlushData::Link_link> link, invert_link;
-  ProxyMutex *mutex = this_thread()->mutex;
+  ProxyMutex *mutex = this_thread()->mutex.get();
 
   Log::flush_notify->lock();
 
diff --git a/proxy/logging/LogFile.cc b/proxy/logging/LogFile.cc
index 21cfb2b..e63de18 100644
--- a/proxy/logging/LogFile.cc
+++ b/proxy/logging/LogFile.cc
@@ -314,7 +314,7 @@ LogFile::preproc_and_try_delete(LogBuffer *lb)
     //
     LogFlushData *flush_data = new LogFlushData(this, lb);
 
-    ProxyMutex *mutex = this_thread()->mutex;
+    ProxyMutex *mutex = this_thread()->mutex.get();
 
     RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_num_flush_to_disk_stat, lb->header()->entry_count);
 
@@ -422,7 +422,7 @@ LogFile::write_ascii_logbuffer3(LogBufferHeader *buffer_header, const
char *alt_
         m_name, this);
   ink_assert(buffer_header != NULL);
 
-  ProxyMutex *mutex = this_thread()->mutex;
+  ProxyMutex *mutex = this_thread()->mutex.get();
   LogBufferIterator iter(buffer_header);
   LogEntryHeader *entry_header;
   int fmt_entry_count = 0;
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index 2ce619b..2375d12 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -1301,7 +1301,7 @@ int
 LogObjectManager::log(LogAccess *lad)
 {
   int ret = Log::SKIP;
-  ProxyMutex *mutex = this_thread()->mutex;
+  ProxyMutex *mutex = this_thread()->mutex.get();
 
   for (unsigned i = 0; i < this->_objects.length(); i++) {
     //

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message