From 41bb8bd542d37fc6fcce6c908ad11528a1c1db65 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 26 Feb 2006 21:20:52 +0000 Subject: Fixed bug pj_thread_register() when same thread is re-registered with different descriptor git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@233 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/config.c | 2 +- pjlib/src/pj/os_core_linux_kernel.c | 9 +++++++-- pjlib/src/pj/os_core_unix.c | 9 +++++++-- pjlib/src/pj/os_core_win32.c | 9 +++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'pjlib/src/pj') diff --git a/pjlib/src/pj/config.c b/pjlib/src/pj/config.c index bc9015f4..385baad7 100644 --- a/pjlib/src/pj/config.c +++ b/pjlib/src/pj/config.c @@ -21,7 +21,7 @@ #include static const char *id = "config.c"; -const char *PJ_VERSION = "0.5.1.3"; +const char *PJ_VERSION = "0.5.2"; PJ_DEF(void) pj_dump_config(void) { diff --git a/pjlib/src/pj/os_core_linux_kernel.c b/pjlib/src/pj/os_core_linux_kernel.c index b91e4e0f..b85e9ba1 100644 --- a/pjlib/src/pj/os_core_linux_kernel.c +++ b/pjlib/src/pj/os_core_linux_kernel.c @@ -251,8 +251,13 @@ PJ_DEF(pj_status_t) pj_thread_register ( const char *cstr_thread_name, /* If a thread descriptor has been registered before, just return it. */ if (pj_thread_local_get (thread_tls_id) != 0) { - *ptr_thread = (pj_thread_t*)pj_thread_local_get (thread_tls_id); - return PJ_SUCCESS; + // 2006-02-26 bennylp: + // This wouldn't work in all cases!. + // If thread is created by external module (e.g. sound thread), + // thread may be reused while the pool used for the thread descriptor + // has been deleted by application. + //*thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id); + //return PJ_SUCCESS; } /* Initialize and set the thread entry. */ diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c index 03713e9a..72e22ef1 100644 --- a/pjlib/src/pj/os_core_unix.c +++ b/pjlib/src/pj/os_core_unix.c @@ -189,8 +189,13 @@ PJ_DEF(pj_status_t) pj_thread_register ( const char *cstr_thread_name, /* If a thread descriptor has been registered before, just return it. */ if (pj_thread_local_get (thread_tls_id) != 0) { - *ptr_thread = (pj_thread_t*)pj_thread_local_get (thread_tls_id); - return PJ_SUCCESS; + // 2006-02-26 bennylp: + // This wouldn't work in all cases!. + // If thread is created by external module (e.g. sound thread), + // thread may be reused while the pool used for the thread descriptor + // has been deleted by application. + //*thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id); + //return PJ_SUCCESS; } /* Initialize and set the thread entry. */ diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c index 94c438fe..a7aee215 100644 --- a/pjlib/src/pj/os_core_win32.c +++ b/pjlib/src/pj/os_core_win32.c @@ -202,8 +202,13 @@ PJ_DEF(pj_status_t) pj_thread_register ( const char *cstr_thread_name, /* If a thread descriptor has been registered before, just return it. */ if (pj_thread_local_get (thread_tls_id) != 0) { - *thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id); - return PJ_SUCCESS; + // 2006-02-26 bennylp: + // This wouldn't work in all cases!. + // If thread is created by external module (e.g. sound thread), + // thread may be reused while the pool used for the thread descriptor + // has been deleted by application. + //*thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id); + //return PJ_SUCCESS; } /* Initialize and set the thread entry. */ -- cgit v1.2.3