summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-01-22 19:10:17 +0000
committerBenny Prijono <bennylp@teluu.com>2007-01-22 19:10:17 +0000
commit06b85d75ffb639032a22802bbe8914c70d48fb03 (patch)
treeb165ddb86b32d14d8a2a0ecbe1c764d4096b88fe /pjlib
parent5d7fc1ab44dd43d9170119bafbd2fc54c0829a8c (diff)
Give more useful information when assertion fails in pj_thread_this()
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@896 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/os_core_unix.c7
-rw-r--r--pjlib/src/pj/os_core_win32.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c
index 4ebdedeb..59b60b0f 100644
--- a/pjlib/src/pj/os_core_unix.c
+++ b/pjlib/src/pj/os_core_unix.c
@@ -507,7 +507,12 @@ PJ_DEF(pj_thread_t*) pj_thread_this(void)
{
#if PJ_HAS_THREADS
pj_thread_t *rec = pj_thread_local_get(thread_tls_id);
- pj_assert(rec != NULL);
+
+ if (rec == NULL) {
+ pj_assert(!"Calling pjlib from unknown/external thread. You must "
+ "register external threads with pj_thread_register() "
+ "before calling any pjlib functions.");
+ }
/*
* MUST NOT check stack because this function is called
diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c
index 788d71f5..4a1f1bbe 100644
--- a/pjlib/src/pj/os_core_win32.c
+++ b/pjlib/src/pj/os_core_win32.c
@@ -429,7 +429,12 @@ PJ_DEF(pj_status_t) pj_thread_resume(pj_thread_t *p)
PJ_DEF(pj_thread_t*) pj_thread_this(void)
{
pj_thread_t *rec = pj_thread_local_get(thread_tls_id);
- pj_assert(rec != NULL);
+
+ if (rec == NULL) {
+ pj_assert(!"Calling pjlib from unknown/external thread. You must "
+ "register external threads with pj_thread_register() "
+ "before calling any pjlib functions.");
+ }
/*
* MUST NOT check stack because this function is called