summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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