Repository: trafficserver Updated Branches: refs/heads/master ffe2484d1 -> 53e56ffc7
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53e56ffc/proxy/http/HttpPages.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpPages.cc b/proxy/http/HttpPages.cc index def7661..a40d67e 100644 --- a/proxy/http/HttpPages.cc +++ b/proxy/http/HttpPages.cc @@ -311,7 +311,7 @@ HttpPagesHandler::handle_smdetails(int event, void * /* data ATS_UNUSED */) for (; list_bucket < HTTP_LIST_BUCKETS; list_bucket++) { MUTEX_TRY_LOCK(lock, HttpSMList[list_bucket].mutex, ethread); - if (!lock) { + if (!lock.is_locked()) { eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); return EVENT_DONE; } @@ -324,7 +324,7 @@ HttpPagesHandler::handle_smdetails(int event, void * /* data ATS_UNUSED */) // state machine { MUTEX_TRY_LOCK(sm_lock, sm->mutex, ethread); - if (sm_lock) { + if (sm_lock.is_locked()) { dump_sm(sm); resp_end(); return handle_callback(EVENT_NONE, NULL); @@ -371,7 +371,7 @@ HttpPagesHandler::handle_smlist(int event, void */* data ATS_UNUSED */) for (; list_bucket < HTTP_LIST_BUCKETS; list_bucket++) { MUTEX_TRY_LOCK(lock, HttpSMList[list_bucket].mutex, ethread); - if (!lock) { + if (!lock.is_locked()) { eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); return EVENT_DONE; } @@ -389,7 +389,7 @@ HttpPagesHandler::handle_smlist(int event, void */* data ATS_UNUSED */) // state machine { MUTEX_TRY_LOCK(sm_lock, sm->mutex, ethread); - if (sm_lock) { + if (sm_lock.is_locked()) { if (sm->t_state.hdr_info.client_request.valid()) { sm_state = HttpDebugNames::get_action_name(sm->t_state.next_action); @@ -431,7 +431,7 @@ int HttpPagesHandler::handle_callback(int /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */) { MUTEX_TRY_LOCK(trylock, action.mutex, this_ethread()); - if (!trylock) { + if (!trylock.is_locked()) { SET_HANDLER(&HttpPagesHandler::handle_callback); eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); return EVENT_DONE; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53e56ffc/proxy/http/HttpProxyServerMain.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc index 5c966b8..4a6be1b 100644 --- a/proxy/http/HttpProxyServerMain.cc +++ b/proxy/http/HttpProxyServerMain.cc @@ -43,12 +43,12 @@ HttpSessionAccept *plugin_http_accept = NULL; HttpSessionAccept *plugin_http_transparent_accept = 0; static SLL<SSLNextProtocolAccept> ssl_plugin_acceptors; -static ink_mutex ssl_plugin_mutex = PTHREAD_MUTEX_INITIALIZER; +static ProxyMutex ssl_plugin_mutex; bool ssl_register_protocol(const char * protocol, Continuation * contp) { - ink_scoped_mutex lock(ssl_plugin_mutex); + MUTEX_LOCK(lock, &ssl_plugin_mutex, this_ethread()); for (SSLNextProtocolAccept * ssl = ssl_plugin_acceptors.head; ssl; ssl = ssl_plugin_acceptors.next(ssl)) { @@ -63,7 +63,7 @@ ssl_register_protocol(const char * protocol, Continuation * contp) bool ssl_unregister_protocol(const char * protocol, Continuation * contp) { - ink_scoped_mutex lock(ssl_plugin_mutex); + MUTEX_LOCK(lock, &ssl_plugin_mutex, this_ethread()); for (SSLNextProtocolAccept * ssl = ssl_plugin_acceptors.head; ssl; ssl = ssl_plugin_acceptors.next(ssl)) { @@ -224,7 +224,7 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned } #endif - ink_scoped_mutex lock(ssl_plugin_mutex); + MUTEX_LOCK(lock, &ssl_plugin_mutex, this_ethread()); ssl_plugin_acceptors.push(ssl); acceptor._accept = ssl; @@ -263,7 +263,7 @@ init_HttpProxyServer(int n_accept_threads) plugin_http_transparent_accept = new HttpSessionAccept(ha_opt); plugin_http_transparent_accept->mutex = new_ProxyMutex(); } - ink_mutex_init(&ssl_plugin_mutex, "SSL Acceptor List"); + ssl_plugin_mutex.init("SSL Acceptor List"); // Do the configuration defined ports. for ( int i = 0 , n = proxy_ports.length() ; i < n ; ++i ) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53e56ffc/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index fc97b7e..a095f57 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -469,7 +469,7 @@ HttpSM::state_add_to_list(int event, void * /* data ATS_UNUSED */) // the client_vc`s timeout events can be triggered, so we should not // reschedule the http_sm when the lock is not acquired. // FIXME: the sm_list may miss some http_sms when the lock contention - if (lock) + if (lock.is_locked()) HttpSMList[bucket].sm_list.push(this); } @@ -493,7 +493,7 @@ HttpSM::state_remove_from_list(int event, void * /* data ATS_UNUSED */) int bucket = ((unsigned int) sm_id % HTTP_LIST_BUCKETS); MUTEX_TRY_LOCK(lock, HttpSMList[bucket].mutex, mutex->thread_holding); - if (!lock) { + if (!lock.is_locked()) { HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_remove_from_list); mutex->thread_holding->schedule_in(this, HTTP_LIST_RETRY); return EVENT_DONE; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53e56ffc/proxy/http/HttpSessionManager.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc index e1c4c35..101955b 100644 --- a/proxy/http/HttpSessionManager.cc +++ b/proxy/http/HttpSessionManager.cc @@ -222,7 +222,7 @@ HttpSessionManager::purge_keepalives() EThread *ethread = this_ethread(); MUTEX_TRY_LOCK(lock, m_g_pool->mutex, ethread); - if (lock) { + if (lock.is_locked()) { m_g_pool->purge(); } // should we do something clever if we don't get the lock? } @@ -263,7 +263,7 @@ HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUSED */, sockad to_return = ethread->server_session_pool->acquireSession(ip, hostname_hash, match_style); } else { MUTEX_TRY_LOCK(lock, m_g_pool->mutex, ethread); - if (lock) { + if (lock.is_locked()) { to_return = m_g_pool->acquireSession(ip, hostname_hash, match_style); Debug("http_ss", "[acquire session] pool search %s", to_return ? "successful" : "failed"); } else { @@ -290,7 +290,7 @@ HttpSessionManager::release_session(HttpServerSession *to_release) // The per thread lock looks like it should not be needed but if it's not locked the close checking I/O op will crash. MUTEX_TRY_LOCK(lock, pool->mutex, ethread); - if (lock) { + if (lock.is_locked()) { pool->releaseSession(to_release); } else { Debug("http_ss", "[%" PRId64 "] [release session] could not release session due to lock contention", to_release->con_id); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53e56ffc/proxy/http/HttpUpdateSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpUpdateSM.cc b/proxy/http/HttpUpdateSM.cc index a5b604e..3bb4d9b 100644 --- a/proxy/http/HttpUpdateSM.cc +++ b/proxy/http/HttpUpdateSM.cc @@ -214,7 +214,7 @@ HttpUpdateSM::kill_this_async_hook(int event, void * /* data ATS_UNUSED */) MUTEX_TRY_LOCK(lock, cb_action.mutex, this_ethread()); - if (!lock) { + if (!lock.is_locked()) { default_handler = (HttpSMHandler) & HttpUpdateSM::kill_this_async_hook; eventProcessor.schedule_in(this, HRTIME_MSECONDS(10), ET_CALL); return EVENT_DONE;
