[TS-2651] atscppapi: race conditions in destruction of async providers
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5ae5dda4 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5ae5dda4 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5ae5dda4 Branch: refs/heads/lua_config Commit: 5ae5dda47b99fdcdb4e99498693c877c0af5c4e7 Parents: cc9f617 Author: Brian Geffon <[email protected]> Authored: Wed Mar 19 15:57:17 2014 -0700 Committer: Brian Geffon <[email protected]> Committed: Wed Mar 19 15:57:17 2014 -0700 ---------------------------------------------------------------------- lib/atscppapi/src/AsyncTimer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ae5dda4/lib/atscppapi/src/AsyncTimer.cc ---------------------------------------------------------------------- diff --git a/lib/atscppapi/src/AsyncTimer.cc b/lib/atscppapi/src/AsyncTimer.cc index 975af3c..995cc48 100644 --- a/lib/atscppapi/src/AsyncTimer.cc +++ b/lib/atscppapi/src/AsyncTimer.cc @@ -63,8 +63,7 @@ int handleTimerEvent(TSCont cont, TSEvent event, void *edata) { AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms) { state_ = new AsyncTimerState(type, period_in_ms, initial_period_in_ms, this); - TSMutex null_mutex = NULL; - state_->cont_ = TSContCreate(handleTimerEvent, null_mutex); + state_->cont_ = TSContCreate(handleTimerEvent, TSMutexCreate()); TSContDataSet(state_->cont_, static_cast<void *>(state_)); } @@ -92,6 +91,7 @@ void AsyncTimer::run(shared_ptr<AsyncDispatchControllerBase> dispatch_controller } AsyncTimer::~AsyncTimer() { + TSMutexLock(TSContMutexGet(state_->cont_)); if (state_->initial_timer_action_) { LOG_DEBUG("Canceling initial timer action"); TSActionCancel(state_->initial_timer_action_);
