Fixed link errors in ioqueue epoll backend

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@590 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/ioqueue_epoll.c b/pjlib/src/pj/ioqueue_epoll.c
index f732c67..14a6cc3 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 @@
 	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_lock_release(ioqueue->lock);
 
     /* Destroy the key. */
-    ioqueue_destroy_key(key);
+    pj_sock_close(key->fd);
+    pj_mutex_destroy(key->mutex);
 
     return PJ_SUCCESS;
 }