summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYoungHun Kim <yh8004.kim@samsung.com>2019-08-30 15:04:11 +0900
committerYoungHun Kim <yh8004.kim@samsung.com>2019-09-18 11:17:25 +0900
commit59c108395fcf74892d28f51fb39e4ccc1bf5cbc2 (patch)
tree0c1253636b7a4c75c59e350ebbba0444f39b6012 /src
parentaade6316b0de6e75e4b71ca60ec9a23f0d6e16f6 (diff)
downloadmurphy-59c108395fcf74892d28f51fb39e4ccc1bf5cbc2.tar.gz
murphy-59c108395fcf74892d28f51fb39e4ccc1bf5cbc2.tar.bz2
murphy-59c108395fcf74892d28f51fb39e4ccc1bf5cbc2.zip
fixup! Move mutexes and condition from static memory allocation to dynamic
- Add missing mutex lock Change-Id: I6554ead33d02b3578b9442c89e262dc8ce1fd172
Diffstat (limited to 'src')
-rw-r--r--src/common/mainloop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/mainloop.c b/src/common/mainloop.c
index cff4385..950c581 100644
--- a/src/common/mainloop.c
+++ b/src/common/mainloop.c
@@ -2140,12 +2140,15 @@ static void dispatch_subloops(mrp_mainloop_t *ml)
}
-static void dispatch_slaves(mrp_io_watch_t *w, struct epoll_event *e)
+static void dispatch_slaves(mrp_mainloop_t *ml, mrp_io_watch_t *w, struct epoll_event *e)
{
mrp_io_watch_t *s;
mrp_list_hook_t *p, *n;
mrp_io_event_t events;
+ if (ml->quit)
+ return;
+
events = e->events & ~(MRP_IO_EVENT_INOUT & w->events);
mrp_list_foreach(&w->slave, p, n) {
@@ -2156,7 +2159,9 @@ static void dispatch_slaves(mrp_io_watch_t *w, struct epoll_event *e)
if (!is_deleted(s)) {
mrp_debug("dispatching slave I/O watch %p (fd %d)", s, s->fd);
+ pthread_mutex_unlock(&ml->lock);
s->cb(s, s->fd, events, s->user_data);
+ pthread_mutex_lock(&ml->lock);
}
else
mrp_debug("skipping slave I/O watch %p (fd %d)", s, s->fd);
@@ -2191,7 +2196,7 @@ static void dispatch_poll_events(mrp_mainloop_t *ml)
mrp_debug("skipping deleted I/O watch %p (fd %d)", w, fd);
if (!mrp_list_empty(&w->slave))
- dispatch_slaves(w, e);
+ dispatch_slaves(ml, w, e);
if (e->events & EPOLLRDHUP) {
tblw = fdtbl_lookup(ml->fdtbl, w->fd);