Give more useful information when assertion fails in pj_thread_this()

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@896 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2007-01-22 19:10:17 +00:00
parent a66c331766
commit 9cee77f25a
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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