You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wk...@apache.org on 2023/03/01 01:17:47 UTC
[trafficserver] branch master updated: Ethread::process_event(): make sure event mutex is unlocked before freeing event. (#9433)
This is an automated email from the ASF dual-hosted git repository.
wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 95b3f2b75 Ethread::process_event(): make sure event mutex is unlocked before freeing event. (#9433)
95b3f2b75 is described below
commit 95b3f2b7500acfebf073ce8e78e0c15e719ed1c3
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Tue Feb 28 19:17:38 2023 -0600
Ethread::process_event(): make sure event mutex is unlocked before freeing event. (#9433)
Also adds important information to docs about TSMutexDestroy().
---
doc/developer-guide/api/functions/TSContCreate.en.rst | 5 +++++
doc/developer-guide/api/functions/TSMutexDestroy.en.rst | 4 +++-
iocore/eventsystem/UnixEThread.cc | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/doc/developer-guide/api/functions/TSContCreate.en.rst b/doc/developer-guide/api/functions/TSContCreate.en.rst
index 774343239..716e21e6a 100644
--- a/doc/developer-guide/api/functions/TSContCreate.en.rst
+++ b/doc/developer-guide/api/functions/TSContCreate.en.rst
@@ -32,3 +32,8 @@ Synopsis
Description
===========
+Creates a continuation, which can be destroyed with :func:`TSContDestroy`.
+**Note:** when a mutex is passed to a call to this function, it creates a
+reference to the mutex. The mutex will be destroyed when the number of
+continuations refering to it becomes zero (due to calls to :func:`TSContDestroy`).
+:func:`TSMutexDestroy` must not be called for the mutex.
diff --git a/doc/developer-guide/api/functions/TSMutexDestroy.en.rst b/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
index ca8410850..462368498 100644
--- a/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
+++ b/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
@@ -34,4 +34,6 @@ Description
===========
Destroys the indicated :arg:`mutex` previously created via
-:func:`TSMutexCreate`.
+:func:`TSMutexCreate`. **Note:** Do not call this function for a mutex that
+was passed to :func:`TSContCreate` as a parameter. It will be destroyed by call(s)
+to :func:`TSContDestroy`.
diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index 115ae6d86..cadeea977 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -139,6 +139,7 @@ EThread::process_event(Event *e, int calling_code)
EventQueueExternal.enqueue_local(e);
} else {
if (e->cancelled) {
+ MUTEX_RELEASE(lock);
free_event(e);
return;
}