diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-06 20:43:07 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-06 20:43:07 +0000 |
commit | 4d30593203dace6434dd6524fea46d355708f62f (patch) | |
tree | 741bf7002a9db9819ace81ca1988715f6c4990cf /pjlib/src/pj/ioqueue_epoll.c | |
parent | 163c395b2cfc15caf83ab2d46e79246c3909affd (diff) |
Fixed link errors in ioqueue epoll backend
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@590 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/ioqueue_epoll.c')
-rw-r--r-- | pjlib/src/pj/ioqueue_epoll.c | 15 |
1 files changed, 12 insertions, 3 deletions
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; } |