> On Mar 4, 2016, at 4:14 PM, Alex Zavatone <z...@mac.com> wrote:
> 
> I'm working with PJSIP and PJ's docs clearly state, "we are going to crater 
> unless you do everything SIP related on the main thread."

Ugh. And of course, doing networking on the main thread is a no-no according to 
Apple.

——

First, it might be worth seeing if you can have a PJSIP queue (preferred) or 
thread, which isn’t the main thread — if there are no locks in PJSIP, but it 
doesn’t use thread-local storage, then it only need to be protected from 
reentrancy — then you can just make all your PJSIP calls from blocks wrapped in 
dispatch_async on the PJSIP queue. Thread-local storage complicates this. But I 
digress…

——

How is the storage of your C strings allocated? malloc()?

What I’d do is use CFString (from CoreFoundation, which is a C API and does all 
the right callback stuff) and take advantage of the fact the CFString is 
toll-free bridged to NSString.

Now your C code returns a CFString (C API) which can be cast to NSString as 
soon at it hits Obj-C code.

HTH,

-Steve



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to