unknown/external thread

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

 



On Wed, May 14, 2008 at 11:30 PM, Samuel Vinson <samuelv at laposte.net> wrote:
> Hi Benny,
>
>  I tried your solution but the mailing archive on gmane begin from
>  27/05/2005, and my search give me an interesting article from march 2007 :-(
>  And there is not cached version :-(
>

Oh damn, I forgot to save the old archive when we formatted the web server.. :(

>  But I don't understand why pjsua give me this assertion, because all
>  threads are created internally.
>

Including the sound device callback's thread?

>  I made several test :
>    - run pjlib-test, and for threads test I need to uncomment in
>  thread_proc function to get successful result.
>         //Must sleep if platform doesn't do time-slicing.
>         pj_thread_sleep(0);
>
>    - convert this code
>  (http://blogs.sun.com/seongbae/entry/pthread_get_set_specific_vs) to
>  pjlib. After pj_init call, I need to call pj_thread_local_alloc
>  otherwise pj_thread_local_set failed.
>
>    - if I run pjsua with null audio the assertion is not present.
>
>  So I tested to call in audio callback:
>   if(!pj_thread_is_registered()) {
>   pj_thread_register(NULL,desc,&thread);
>   }
>  And assertion disappeared. But I think it's not optimal.
>

So it looks like the sound callbacks are running on threads that are
created externally indeed.

It's probably suboptimal, but we don't have any other choice I'm
afraid. If you're worried with with the extra
pj_thread_is_registered() function call, you can always replace
pj_thread_is_registered() with your own flag, if we're sure that the
audio callback will always create a thread.

Cheers
 Benny


>
>  Samuel
>
>
>  Benny Prijono a ?crit :
>
>
> > On Tue, May 13, 2008 at 8:27 AM, Samuel Vinson <samuelv at laposte.net> wrote:
>  >> Hi,
>  >>
>  >>  I'm using the last version in trunk of pjsip.
>  >>  When I use pjsua I receive this assertion :
>  >>
>  >>  Assertion failed: (!"Calling pjlib from unknown/external thread. You
>  >>  must " "register external threads with pj_thread_register() " "before
>  >>  calling any pjlib functions."), function pj_thread_this, file
>  >>  ../src/pj/os_core_unix.c, line 620.
>  >>
>  >>  For information line 620: pj_thread_this() function
>  >>
>  >>  I don't think this is a problem of pj_thread_register, but perhaps some
>  >>  pthread functions don't work correctly on Ipod/iphone.
>  >>
>  >>  I think that the topic has already been discussed on the mailing list
>  >>  but I don't find when :-(
>  >>
>  >>  What do you think ?
>  >>
>  >
>  > Yep this has been discussed quite a number of times. Just do Google
>  > site search (the little text box on the top right corner of pjsip.org
>  > website) on pj_thread_register.
>  >
>  > Cheers
>  >  Benny
>  >
>
>
> > _______________________________________________
>  > 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