Changes between Version 86 and Version 87 of Getting-Started/iPhone


Ignore:
Timestamp:
Mar 14, 2016 4:08:00 AM (8 years ago)
Author:
nanang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/iPhone

    v86 v87  
    313313Alternatively, configuring server to send keepalive ping packet, if possible, and client responds back by sending keepalive pong to the server, so we have two-way traffic. As there is no way to detect incoming ping from server, currently application can just always send pong packet whenever it becomes active (application will be woken up when receiving TCP packet), e.g: send pong packet in UIApplication::applicationDidBecomeActive(). 
    314314 
     315 
     316=== Crash after calling PJLIB APIs using Grand Central Dispatch (GCD) === #gcd-crash 
     317 
     318PJLIB API should be called from a registered thread, otherwise it will raise assertion such as "Calling pjlib from unknown/external thread...". With GCD, we cannot really be sure of which thread executing the PJLIB function. Registering that thread to PJLIB seems to be a simple and easy solution, however it potentially introduces a random crash which is harder to debug. Here are few possible crash scenarios: 
     319 - PJLIB's {{{pj_thread_desc}}} should remain valid until the registered thread stopped, otherwise crash of invalid pointer access may occur, e.g: in {{{pj_thread_check_stack()}}}. 
     320 - Some compatibility problems between GCD and PJLIB, see #1837 for more info. 
     321 
     322If you want to avoid any possibility of blocking operation by PJLIB (or any higher API layer such as PJMEDIA, PJNATH, PJSUA that usually calls PJLIB), instead of dispatching the task using GCD, the safest way is to create and manage your own thread pool and register that thread pool to PJLIB. Or alternatively, simply use PJSUA timer mechanism (with zero delay), see {{{pjsua_schedule_timer()/pjsua_schedule_timer2()}}} docs for more info. 
     323 
     324 
    315325=== List of Issues === 
    316326