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:
parent
a66c331766
commit
9cee77f25a
2 changed files with 12 additions and 2 deletions
|
@ -507,7 +507,12 @@ PJ_DEF(pj_thread_t*) pj_thread_this(void)
|
||||||
{
|
{
|
||||||
#if PJ_HAS_THREADS
|
#if PJ_HAS_THREADS
|
||||||
pj_thread_t *rec = pj_thread_local_get(thread_tls_id);
|
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
|
* MUST NOT check stack because this function is called
|
||||||
|
|
|
@ -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_DEF(pj_thread_t*) pj_thread_this(void)
|
||||||
{
|
{
|
||||||
pj_thread_t *rec = pj_thread_local_get(thread_tls_id);
|
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
|
* MUST NOT check stack because this function is called
|
||||||
|
|
Loading…
Reference in a new issue