From 4d30593203dace6434dd6524fea46d355708f62f Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 6 Jul 2006 20:43:07 +0000 Subject: Fixed link errors in ioqueue epoll backend git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@590 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/ioqueue_epoll.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'pjlib/src/pj') diff --git a/pjlib/src/pj/ioqueue_epoll.c b/pjlib/src/pj/ioqueue_epoll.c index f732c67f..14a6cc32 100644 --- a/pjlib/src/pj/ioqueue_epoll.c +++ b/pjlib/src/pj/ioqueue_epoll.c @@ -141,8 +141,8 @@ #define THIS_FILE "ioq_epoll" -//#define TRACE_(expr) PJ_LOG(3,expr) -#define TRACE_(expr) +#define TRACE_(expr) PJ_LOG(3,expr) +//#define TRACE_(expr) /* * Include common ioqueue abstraction. @@ -297,12 +297,20 @@ PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool, goto on_return; } + /* Create key's mutex */ + rc = pj_mutex_create_recursive(pool, NULL, &key->mutex); + if (rc != PJ_SUCCESS) { + key = NULL; + goto on_return; + } + /* os_epoll_ctl. */ ev.events = EPOLLIN | EPOLLOUT | EPOLLERR; ev.epoll_data = (epoll_data_type)key; status = os_epoll_ctl(ioqueue->epfd, EPOLL_CTL_ADD, sock, &ev); if (status < 0) { rc = pj_get_os_error(); + pj_mutex_destroy(key->mutex); key = NULL; TRACE_((THIS_FILE, "pj_ioqueue_register_sock error: os_epoll_ctl rc=%d", @@ -353,7 +361,8 @@ PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key) pj_lock_release(ioqueue->lock); /* Destroy the key. */ - ioqueue_destroy_key(key); + pj_sock_close(key->fd); + pj_mutex_destroy(key->mutex); return PJ_SUCCESS; } -- cgit v1.2.3