Thread-Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benny,
I tried out your suggestion but futile.
See http://pastebin.mozilla.org/347117

I included this snippet in each function call.

   1.
        static pj_thread_desc desc;
   2.
              static pj_thread_t *  thread;
   3.
      #define REGISTER_THREAD()       \
   4.
              if(!pj_thread_is_registered()) {\
   5.
              pj_thread_register(NULL,desc,&thread);\

The static variables won't get called (i.e. resulting in an error) when 
placed in a global scope.

Otherwise, the integration is OK but I can't re-register once I 
de-register, my browser crashes. I mean that is when I get this error:

 firefox-bin: ../src/pj/os_core_unix.c:276: pj_thread_register: Assertion
 `thread->signature1 != 0xDEAFBEEF || thread->signature2 != 0xDEADC0DE ||
 (thread->thread == pthread_self())' failed.
 [New LWP 11919]

Yours,
Michael.




Benny Prijono wrote:
> On 2/25/08, Adeyeye O. Michael <micadeyeye at crg.ee.uct.ac.za> wrote:
>   
>> HI Benny,
>>  I have pjsip integrated successfully into Mozilla FF in a
>>  loosely-coupled approach. The immediate problem is that once I
>>  de-register and try to register again, my browser hangs/crashes.
>>  Obviously, it has to do with thread because here is the error that I get
>>  at the console:
>>
>>  firefox-bin: ../src/pj/os_core_unix.c:276: pj_thread_register: Assertion
>>  `thread->signature1 != 0xDEAFBEEF || thread->signature2 != 0xDEADC0DE ||
>>  (thread->thread == pthread_self())' failed.
>>  [New LWP 11919]
>>
>>  I understand that I need to register a thread when using an external
>>  API/program. First, my browser crashes when I try registering a thread
>>     
>
> Just to be more precise, you need to register the current thread
> before calling PJSIP/PJLIB API, *only* when the current thread has not
> been registered to PJLIB before *and* this thread was created using
> native thread API rather than pj_thread_create().
>
>   
>>  before using pjsua_create,pjsua_init or pjsua_start. Otherwise, it works
>>  fine when i perform the registration task(pjsua_init, pjsua_start)
>>  without registering a thread first (i.e. it is using the PJSUA
>>     
>
> FYI pjsua_create() will call pj_create() to initialize PJLIB, and this
> implicitly registers current thread to PJLIB. In other words, no need
> to register the thread that calls pjsua_create() since this will have
> been done in pj_create().
>
>   
>>  self-generated thread). Whenever I want to perform task like send IM and
>>  de-register, I need to register a thread (though same thread parameters).
>>
>>     
>
> Yes, that's a good approach. A slightly better approach probably is to
> check whether the thread has been registered before registering it
> again, using pj_thread_is_registered().
>
> But there is a bug in your code. When registering a thread, the
> pj_thread_desc MUST have a lifetime that's at least the same as the
> thread being registered (or the easiest is to make the pj_thread_desc
> variable static). So you cannot allocate this from a local variable
> like the one in your code.
>
> cheers,
>  -benny
>
>
>
>   
>>  I usually call pjsua_destroy (to free resourses and de-register). Should
>>  I do this, my browser will crash whenever I want to register again and
>>  produces the error above. I tried couple of things like unregistering
>>  current/all thread (s) before/after calling pjsua_destroy but won't work.
>>
>>  Any useful info on this. Here is my implementation code with thread
>>  being registered when sending IM (line 297) and destroying(line 374):
>>  http://pastebin.mozilla.org/343980
>>
>>  Is any resource is in use or there are existing threads after destroying??
>>  How can I fix this??
>>
>>  Sorry for my poorly indented code!!!
>>  Mike.
>>
>>  _______________________________________________
>>  Visit our blog: http://blog.pjsip.org
>>
>>  pjsip mailing list
>>  pjsip at lists.pjsip.org
>>  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>     
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>   




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux