Couple of fixes in ioqueue_epoll for ticket #622 (still not working)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2300 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2008-09-19 22:18:50 +00:00
parent b51845f64c
commit 9489e7a098
3 changed files with 5307 additions and 5220 deletions

10516
aconfigure

File diff suppressed because it is too large Load Diff

View File

@ -329,7 +329,7 @@ AC_SUBST(ac_os_objs)
AC_MSG_CHECKING([ioqueue backend])
AC_ARG_ENABLE(epoll,
AC_HELP_STRING([--enable-epoll],
[Use /dev/epoll ioqueue on Linux (beta)]),
[Use /dev/epoll ioqueue on Linux (experimental)]),
[
ac_os_objs=ioqueue_epoll.o
AC_MSG_RESULT([/dev/epoll])

View File

@ -253,6 +253,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_create( pj_pool_t *pool,
/* Init key list */
pj_list_init(&ioqueue->free_list);
pj_list_init(&ioqueue->closing_list);
pj_list_init(&ioqueue->active_list);
/* Pre-create all keys according to max_fd */
@ -491,6 +492,14 @@ PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key)
PJ_ASSERT_RETURN(key != NULL, PJ_EINVAL);
ioqueue = key->ioqueue;
/* Lock the key to make sure no callback is simultaneously modifying
* the key. We need to lock the key before ioqueue here to prevent
* deadlock.
*/
pj_mutex_lock(key->mutex);
/* Also lock ioqueue */
pj_lock_acquire(ioqueue->lock);
pj_assert(ioqueue->count > 0);