1999-08-21 06:24:40 +00:00
|
|
|
/*-
|
2017-11-27 15:20:12 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
*
|
1999-08-21 06:24:40 +00:00
|
|
|
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-06-11 00:56:59 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1999-08-21 06:24:40 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/kernel.h>
|
2001-03-28 09:17:56 +00:00
|
|
|
#include <sys/lock.h>
|
1999-08-21 06:24:40 +00:00
|
|
|
#include <sys/malloc.h>
|
2000-12-12 04:01:35 +00:00
|
|
|
#include <sys/mutex.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
#include <sys/proc.h>
|
1999-08-21 06:24:40 +00:00
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/eventhandler.h>
|
|
|
|
|
2000-12-08 20:09:00 +00:00
|
|
|
static MALLOC_DEFINE(M_EVENTHANDLER, "eventhandler", "Event handler records");
|
1999-08-21 06:24:40 +00:00
|
|
|
|
2017-11-09 22:51:48 +00:00
|
|
|
/* List of all eventhandler lists */
|
2000-05-26 02:09:24 +00:00
|
|
|
static TAILQ_HEAD(, eventhandler_list) eventhandler_lists;
|
1999-08-21 06:24:40 +00:00
|
|
|
static int eventhandler_lists_initted = 0;
|
2000-10-25 00:01:39 +00:00
|
|
|
static struct mtx eventhandler_mutex;
|
1999-08-21 06:24:40 +00:00
|
|
|
|
|
|
|
struct eventhandler_entry_generic
|
|
|
|
{
|
|
|
|
struct eventhandler_entry ee;
|
|
|
|
void (* func)(void);
|
|
|
|
};
|
|
|
|
|
2004-12-06 10:53:40 +00:00
|
|
|
static struct eventhandler_list *_eventhandler_find_list(const char *name);
|
2003-03-11 20:17:00 +00:00
|
|
|
|
2000-12-12 04:01:35 +00:00
|
|
|
/*
|
|
|
|
* Initialize the eventhandler mutex and list.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
eventhandler_init(void *dummy __unused)
|
|
|
|
{
|
|
|
|
TAILQ_INIT(&eventhandler_lists);
|
2003-03-11 20:17:00 +00:00
|
|
|
mtx_init(&eventhandler_mutex, "eventhandler", NULL, MTX_DEF);
|
|
|
|
atomic_store_rel_int(&eventhandler_lists_initted, 1);
|
2000-12-12 04:01:35 +00:00
|
|
|
}
|
|
|
|
SYSINIT(eventhandlers, SI_SUB_EVENTHANDLER, SI_ORDER_FIRST, eventhandler_init,
|
2008-03-16 10:58:09 +00:00
|
|
|
NULL);
|
2000-12-12 04:01:35 +00:00
|
|
|
|
2017-11-09 22:51:48 +00:00
|
|
|
static struct eventhandler_list *
|
|
|
|
eventhandler_find_or_create_list(const char *name)
|
1999-08-21 06:24:40 +00:00
|
|
|
{
|
2017-11-09 22:51:48 +00:00
|
|
|
struct eventhandler_list *list, *new_list;
|
2000-09-22 03:17:35 +00:00
|
|
|
|
1999-08-21 06:24:40 +00:00
|
|
|
/* look for a matching, existing list */
|
2003-03-11 20:17:00 +00:00
|
|
|
list = _eventhandler_find_list(name);
|
1999-08-21 06:24:40 +00:00
|
|
|
|
|
|
|
/* Do we need to create the list? */
|
|
|
|
if (list == NULL) {
|
2003-03-11 20:17:00 +00:00
|
|
|
mtx_unlock(&eventhandler_mutex);
|
|
|
|
|
2017-11-09 22:51:48 +00:00
|
|
|
new_list = malloc(sizeof(*new_list) + strlen(name) + 1,
|
|
|
|
M_EVENTHANDLER, M_WAITOK | M_ZERO);
|
2003-03-11 20:17:00 +00:00
|
|
|
|
|
|
|
/* If someone else created it already, then use that one. */
|
|
|
|
mtx_lock(&eventhandler_mutex);
|
|
|
|
list = _eventhandler_find_list(name);
|
|
|
|
if (list != NULL) {
|
|
|
|
free(new_list, M_EVENTHANDLER);
|
|
|
|
} else {
|
|
|
|
CTR2(KTR_EVH, "%s: creating list \"%s\"", __func__, name);
|
|
|
|
list = new_list;
|
2017-11-09 22:51:48 +00:00
|
|
|
TAILQ_INIT(&list->el_entries);
|
|
|
|
mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF);
|
|
|
|
list->el_name = (char *)(list + 1);
|
2003-03-11 20:17:00 +00:00
|
|
|
strcpy(list->el_name, name);
|
|
|
|
TAILQ_INSERT_HEAD(&eventhandler_lists, list, el_link);
|
2000-09-22 03:17:35 +00:00
|
|
|
}
|
1999-08-21 06:24:40 +00:00
|
|
|
}
|
2017-11-09 22:51:48 +00:00
|
|
|
return (list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Insertion is O(n) due to the priority scan, but optimises to O(1)
|
|
|
|
* if all priorities are identical.
|
|
|
|
*/
|
|
|
|
static eventhandler_tag
|
|
|
|
eventhandler_register_internal(struct eventhandler_list *list,
|
|
|
|
const char *name, eventhandler_tag epn)
|
|
|
|
{
|
|
|
|
struct eventhandler_entry *ep;
|
|
|
|
|
|
|
|
KASSERT(eventhandler_lists_initted, ("eventhandler registered too early"));
|
|
|
|
KASSERT(epn != NULL, ("%s: cannot register NULL event", __func__));
|
|
|
|
|
|
|
|
/* Do we need to find/create the list? */
|
|
|
|
if (list == NULL) {
|
|
|
|
mtx_lock(&eventhandler_mutex);
|
|
|
|
list = eventhandler_find_or_create_list(name);
|
|
|
|
mtx_unlock(&eventhandler_mutex);
|
1999-08-21 06:24:40 +00:00
|
|
|
}
|
2003-03-11 20:17:00 +00:00
|
|
|
|
2010-03-19 19:51:03 +00:00
|
|
|
KASSERT(epn->ee_priority != EHE_DEAD_PRIORITY,
|
2003-03-11 20:17:00 +00:00
|
|
|
("%s: handler for %s registered with dead priority", __func__, name));
|
|
|
|
|
1999-08-21 06:24:40 +00:00
|
|
|
/* sort it into the list */
|
2010-03-19 19:51:03 +00:00
|
|
|
CTR4(KTR_EVH, "%s: adding item %p (function %p) to \"%s\"", __func__, epn,
|
|
|
|
((struct eventhandler_entry_generic *)epn)->func, name);
|
2003-03-11 20:17:00 +00:00
|
|
|
EHL_LOCK(list);
|
|
|
|
TAILQ_FOREACH(ep, &list->el_entries, ee_link) {
|
|
|
|
if (ep->ee_priority != EHE_DEAD_PRIORITY &&
|
2010-03-19 19:51:03 +00:00
|
|
|
epn->ee_priority < ep->ee_priority) {
|
|
|
|
TAILQ_INSERT_BEFORE(ep, epn, ee_link);
|
1999-08-21 06:24:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ep == NULL)
|
2010-03-19 19:51:03 +00:00
|
|
|
TAILQ_INSERT_TAIL(&list->el_entries, epn, ee_link);
|
2003-03-11 20:17:00 +00:00
|
|
|
EHL_UNLOCK(list);
|
2010-03-19 19:51:03 +00:00
|
|
|
return(epn);
|
|
|
|
}
|
|
|
|
|
|
|
|
eventhandler_tag
|
|
|
|
eventhandler_register(struct eventhandler_list *list, const char *name,
|
|
|
|
void *func, void *arg, int priority)
|
|
|
|
{
|
|
|
|
struct eventhandler_entry_generic *eg;
|
|
|
|
|
|
|
|
/* allocate an entry for this handler, populate it */
|
|
|
|
eg = malloc(sizeof(struct eventhandler_entry_generic), M_EVENTHANDLER,
|
|
|
|
M_WAITOK | M_ZERO);
|
|
|
|
eg->func = func;
|
|
|
|
eg->ee.ee_arg = arg;
|
|
|
|
eg->ee.ee_priority = priority;
|
|
|
|
|
|
|
|
return (eventhandler_register_internal(list, name, &eg->ee));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef VIMAGE
|
|
|
|
struct eventhandler_entry_generic_vimage
|
|
|
|
{
|
|
|
|
struct eventhandler_entry ee;
|
|
|
|
vimage_iterator_func_t func; /* Vimage iterator function. */
|
|
|
|
struct eventhandler_entry_vimage v_ee; /* Original func, arg. */
|
|
|
|
};
|
|
|
|
|
|
|
|
eventhandler_tag
|
|
|
|
vimage_eventhandler_register(struct eventhandler_list *list, const char *name,
|
|
|
|
void *func, void *arg, int priority, vimage_iterator_func_t iterfunc)
|
|
|
|
{
|
|
|
|
struct eventhandler_entry_generic_vimage *eg;
|
|
|
|
|
|
|
|
/* allocate an entry for this handler, populate it */
|
|
|
|
eg = malloc(sizeof(struct eventhandler_entry_generic_vimage),
|
|
|
|
M_EVENTHANDLER, M_WAITOK | M_ZERO);
|
|
|
|
eg->func = iterfunc;
|
|
|
|
eg->v_ee.func = func;
|
|
|
|
eg->v_ee.ee_arg = arg;
|
|
|
|
eg->ee.ee_arg = &eg->v_ee;
|
|
|
|
eg->ee.ee_priority = priority;
|
|
|
|
|
|
|
|
return (eventhandler_register_internal(list, name, &eg->ee));
|
1999-08-21 06:24:40 +00:00
|
|
|
}
|
2010-03-19 19:51:03 +00:00
|
|
|
#endif
|
1999-08-21 06:24:40 +00:00
|
|
|
|
2017-10-08 17:21:16 +00:00
|
|
|
static void
|
|
|
|
_eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag,
|
|
|
|
bool wait)
|
1999-08-21 06:24:40 +00:00
|
|
|
{
|
|
|
|
struct eventhandler_entry *ep = tag;
|
|
|
|
|
2003-03-11 20:17:00 +00:00
|
|
|
EHL_LOCK_ASSERT(list, MA_OWNED);
|
1999-08-21 06:24:40 +00:00
|
|
|
if (ep != NULL) {
|
|
|
|
/* remove just this entry */
|
2003-03-11 20:17:00 +00:00
|
|
|
if (list->el_runcount == 0) {
|
|
|
|
CTR3(KTR_EVH, "%s: removing item %p from \"%s\"", __func__, ep,
|
|
|
|
list->el_name);
|
|
|
|
TAILQ_REMOVE(&list->el_entries, ep, ee_link);
|
|
|
|
free(ep, M_EVENTHANDLER);
|
|
|
|
} else {
|
|
|
|
CTR3(KTR_EVH, "%s: marking item %p from \"%s\" as dead", __func__,
|
|
|
|
ep, list->el_name);
|
|
|
|
ep->ee_priority = EHE_DEAD_PRIORITY;
|
|
|
|
}
|
1999-08-21 06:24:40 +00:00
|
|
|
} else {
|
|
|
|
/* remove entire list */
|
2003-03-11 20:17:00 +00:00
|
|
|
if (list->el_runcount == 0) {
|
|
|
|
CTR2(KTR_EVH, "%s: removing all items from \"%s\"", __func__,
|
|
|
|
list->el_name);
|
|
|
|
while (!TAILQ_EMPTY(&list->el_entries)) {
|
|
|
|
ep = TAILQ_FIRST(&list->el_entries);
|
|
|
|
TAILQ_REMOVE(&list->el_entries, ep, ee_link);
|
|
|
|
free(ep, M_EVENTHANDLER);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
CTR2(KTR_EVH, "%s: marking all items from \"%s\" as dead",
|
|
|
|
__func__, list->el_name);
|
|
|
|
TAILQ_FOREACH(ep, &list->el_entries, ee_link)
|
|
|
|
ep->ee_priority = EHE_DEAD_PRIORITY;
|
1999-08-21 06:24:40 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-08 17:21:16 +00:00
|
|
|
while (wait && list->el_runcount > 0)
|
2009-12-17 21:17:13 +00:00
|
|
|
mtx_sleep(list, &list->el_lock, 0, "evhrm", 0);
|
2003-03-11 20:17:00 +00:00
|
|
|
EHL_UNLOCK(list);
|
1999-08-21 06:24:40 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 17:21:16 +00:00
|
|
|
void
|
|
|
|
eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag)
|
|
|
|
{
|
|
|
|
|
|
|
|
_eventhandler_deregister(list, tag, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
eventhandler_deregister_nowait(struct eventhandler_list *list,
|
|
|
|
eventhandler_tag tag)
|
|
|
|
{
|
|
|
|
|
|
|
|
_eventhandler_deregister(list, tag, false);
|
|
|
|
}
|
|
|
|
|
2003-03-11 20:17:00 +00:00
|
|
|
/*
|
|
|
|
* Internal version for use when eventhandler list is already locked.
|
|
|
|
*/
|
|
|
|
static struct eventhandler_list *
|
2004-12-06 10:53:40 +00:00
|
|
|
_eventhandler_find_list(const char *name)
|
2003-03-11 20:17:00 +00:00
|
|
|
{
|
|
|
|
struct eventhandler_list *list;
|
|
|
|
|
|
|
|
mtx_assert(&eventhandler_mutex, MA_OWNED);
|
|
|
|
TAILQ_FOREACH(list, &eventhandler_lists, el_link) {
|
|
|
|
if (!strcmp(name, list->el_name))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup a "slow" list by name. Returns with the list locked.
|
|
|
|
*/
|
1999-08-21 06:24:40 +00:00
|
|
|
struct eventhandler_list *
|
2004-12-06 10:53:40 +00:00
|
|
|
eventhandler_find_list(const char *name)
|
1999-08-21 06:24:40 +00:00
|
|
|
{
|
|
|
|
struct eventhandler_list *list;
|
2001-07-31 03:52:16 +00:00
|
|
|
|
|
|
|
if (!eventhandler_lists_initted)
|
|
|
|
return(NULL);
|
2000-09-22 03:17:35 +00:00
|
|
|
|
1999-08-21 06:24:40 +00:00
|
|
|
/* scan looking for the requested list */
|
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
|
|
|
mtx_lock(&eventhandler_mutex);
|
2003-03-11 20:17:00 +00:00
|
|
|
list = _eventhandler_find_list(name);
|
|
|
|
if (list != NULL)
|
|
|
|
EHL_LOCK(list);
|
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
|
|
|
mtx_unlock(&eventhandler_mutex);
|
2000-09-22 03:17:35 +00:00
|
|
|
|
1999-08-21 06:24:40 +00:00
|
|
|
return(list);
|
|
|
|
}
|
2000-09-22 03:17:35 +00:00
|
|
|
|
2003-03-11 20:17:00 +00:00
|
|
|
/*
|
|
|
|
* Prune "dead" entries from an eventhandler list.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
eventhandler_prune_list(struct eventhandler_list *list)
|
|
|
|
{
|
|
|
|
struct eventhandler_entry *ep, *en;
|
2009-12-17 21:17:13 +00:00
|
|
|
int pruned = 0;
|
2003-03-11 20:17:00 +00:00
|
|
|
|
|
|
|
CTR2(KTR_EVH, "%s: pruning list \"%s\"", __func__, list->el_name);
|
|
|
|
EHL_LOCK_ASSERT(list, MA_OWNED);
|
2009-12-17 21:17:13 +00:00
|
|
|
TAILQ_FOREACH_SAFE(ep, &list->el_entries, ee_link, en) {
|
2003-03-11 20:17:00 +00:00
|
|
|
if (ep->ee_priority == EHE_DEAD_PRIORITY) {
|
|
|
|
TAILQ_REMOVE(&list->el_entries, ep, ee_link);
|
|
|
|
free(ep, M_EVENTHANDLER);
|
2009-12-17 21:17:13 +00:00
|
|
|
pruned++;
|
2003-03-11 20:17:00 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-17 21:17:13 +00:00
|
|
|
if (pruned > 0)
|
|
|
|
wakeup(list);
|
2003-03-11 20:17:00 +00:00
|
|
|
}
|
2017-11-09 22:51:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create (or get the existing) list so the pointer can be stored by
|
|
|
|
* EVENTHANDLER_LIST_DEFINE.
|
|
|
|
*/
|
|
|
|
struct eventhandler_list *
|
|
|
|
eventhandler_create_list(const char *name)
|
|
|
|
{
|
|
|
|
struct eventhandler_list *list;
|
|
|
|
|
|
|
|
KASSERT(eventhandler_lists_initted,
|
|
|
|
("eventhandler list created too early"));
|
|
|
|
|
|
|
|
mtx_lock(&eventhandler_mutex);
|
|
|
|
list = eventhandler_find_or_create_list(name);
|
|
|
|
mtx_unlock(&eventhandler_mutex);
|
|
|
|
|
|
|
|
return (list);
|
|
|
|
}
|