From 7da238dc72999218826690a46fe6538470ecde1e Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 11 Aug 2006 19:25:17 +0000 Subject: Added pj_thread_is_registered git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@674 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/os.h | 8 ++++++++ pjlib/src/pj/os_core_unix.c | 9 +++++++++ pjlib/src/pj/os_core_win32.c | 8 ++++++++ 3 files changed, 25 insertions(+) diff --git a/pjlib/include/pj/os.h b/pjlib/include/pj/os.h index ad2b49b1..2720e7f7 100644 --- a/pjlib/include/pj/os.h +++ b/pjlib/include/pj/os.h @@ -129,6 +129,14 @@ PJ_DECL(pj_status_t) pj_thread_register ( const char *thread_name, pj_thread_desc desc, pj_thread_t **thread); +/** + * Check if this thread has been registered to PJLIB. + * + * @return Non-zero if it is registered. + */ +PJ_DECL(pj_status_t) pj_thread_is_registered(void); + + /** * Get thread name. * diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c index 5fd630c1..0dba048e 100644 --- a/pjlib/src/pj/os_core_unix.c +++ b/pjlib/src/pj/os_core_unix.c @@ -178,6 +178,15 @@ PJ_DEF(pj_uint32_t) pj_getpid(void) return getpid(); } +/* + * Check if this thread has been registered to PJLIB. + */ +PJ_DEF(pj_status_t) pj_thread_is_registered(void) +{ + return pj_thread_local_get(thread_tls_id) != 0; +} + + /* * pj_thread_register(..) */ diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c index 565efb3c..8ab04add 100644 --- a/pjlib/src/pj/os_core_win32.c +++ b/pjlib/src/pj/os_core_win32.c @@ -185,6 +185,14 @@ PJ_DEF(pj_uint32_t) pj_getpid(void) return GetCurrentProcessId(); } +/* + * Check if this thread has been registered to PJLIB. + */ +PJ_DEF(pj_status_t) pj_thread_is_registered(void) +{ + return pj_thread_local_get(thread_tls_id) != 0; +} + /* * pj_thread_register(..) */ -- cgit v1.2.3