Replying to myself in hope that it helps someone else and for posterity. I think I fixed my issue. I used su_root_step in my thread loop instead of su_root_run. So now my pseudo code looks like:
AppSingleton *myapp; su_init() su_home_t *tmp tmp = su_home_new() myapp->home = tmp; su_home_init(myapp->home) myapp->root = su_root_osx_runloop_create(*myapp) nua_create(...) su_root_release(myapp->root) pthread_create(thread,NULL,root_thread,NULL) void root_thread() { AppSingleton *myapp; su_root_obtain(myapp->root); su_root_osx_prepare_run(myapp->root); while (1) { su_root_step(myapp->root, 20); } su_root_release)(myapp->root); } If anyone sees an issue with running the event loop in this fashion, please advise me. I'd like to write it in the proper fashion, but this works and does what I want. Thanks, Andy. > -----Original Message----- > From: Andrew Rechenberg Lists [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2008 9:59 AM > To: sofia-sip-devel@lists.sourceforge.net > Subject: Re: [Sofia-sip-devel] Threading and timer questions WRT Sofia > andiPhone > > I think I figured out my problem, but I'm not sure how to fix it. > > I pumped up SU_DEBUG to 9 and I receive line after line of > su_osx_port_run: entering in the console until I my event_callback > function is called the first time, then su_osx_port_run stops appearing > in the console. It's almost as if the root stops running or the thread > terminates. > > What have done incorrectly? > > Thanks again. > > PS Sorry about the 3 postings. I was having issues with my default SMTP > address in Exchange. It shouldn't happen again. > > > -----Original Message----- > > From: Andrew Rechenberg Lists [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, November 18, 2008 9:21 AM > > To: sofia-sip-devel@lists.sourceforge.net > > Subject: [Sofia-sip-devel] Threading and timer questions WRT Sofia and > iPhone > > > > Good day, > > > > I'm doing some personal research on developing for the iPhone and I've > > been using Sofia to create a basic SIP UA for the iPhone. > > > > I have a static Sofia SIP library compiled for the iPhone simulator > and > > my app successfully registers with a SIP server and I can receive SIP > > MESSAGEs as shown by the debugger console for the simulator. > Everything > > works as expected if I don't interact with the iPhone GUI. I have a > > button that will send a REGISTER to my SIP server and I can use the > > sofsip_cli to connect to the same SIP server and send the iPhone UA > SIP > > MESSAGEs and I see them show up in the console. The nua_i_message > > callback fires just fine. > > > > I seem to be having a problem with pop up alerts though on the iPhone > > simulator and I don't know whether it's a threading problem, a timer > > problem with Sofia, or some other problem related to the iPhone and > was > > wondering if someone could provide some assistance. > > > > Once I add code in the event_callback function to show a UIAlertView > > (basically a pop-up dialog on the iPhone), the dialog displays once > and > > once I click OK it disappears, however subsequent nua_i_message events > > timeout with: > > > > nta: timer J fired, terminate 200 response. > > > > Am I missing something with threading? My su_root_t runs in a POSIX > > thread that I created when the application launched. I'm using a > > singleton object that has a pointer to a root as a property to be able > > to pass the root object around (maybe not the RightThing to do?). > > Here's some pseudo-code for how I run it in > > applicationDidFinishLaunching (run after main() runs): > > > > AppSingleton *myapp; > > su_init() > > su_home_t *tmp > > tmp = su_home_new() > > myapp->home = tmp; > > su_home_init(myapp->home) > > myapp->root = su_root_osx_runloop_create(*myapp) > > nua_create(...) > > su_root_release(myapp->root) > > pthread_create(thread,NULL,root_thread,NULL) > > > > void root_thread() { > > AppSingleton *myapp; > > su_root_obtain(myapp->root); > > su_root_osx_prepare_run(myapp->root); > > while (1) { > > su_root_run(myapp->root) > > } > > su_root_release)(myapp->root) > > } > > > > I'm thinking my problem is either with the UIAlertView and/or me not > > understanding how I should be handle the threading of the root object. > > > > This code is my first experience with pthreads so I'm probably doing > > something wrong (maybe need mutexes?). > > > > I'm going to post this question to the Apple Developer Forums as well > > because I don't know where to go from here. > > > > If anyone has more questions, please let me know. > > > > Thanks for your help, > > Andy. > > > > Confidentiality Notice: This e-mail message including attachments, if > any, is > > intended only for the person or entity to which it is addressed and > may > > contain confidential and/or privileged material. Any unauthorized > review, > > use, disclosure or distribution is prohibited. If you are not the > intended > > recipient, please contact the sender by reply e-mail and destroy all > copies > > of the original message. If you are the intended recipient, but do not > wish > > to receive communications through this medium, please so advise the > sender > > immediately. > > > > > ------------------------------------------------------------------------ > - > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Sofia-sip-devel mailing list > > Sofia-sip-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel > > Confidentiality Notice: This e-mail message including attachments, if any, is > intended only for the person or entity to which it is addressed and may > contain confidential and/or privileged material. Any unauthorized review, > use, disclosure or distribution is prohibited. If you are not the intended > recipient, please contact the sender by reply e-mail and destroy all copies > of the original message. If you are the intended recipient, but do not wish > to receive communications through this medium, please so advise the sender > immediately. > > ------------------------------------------------------------------------ - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Sofia-sip-devel mailing list > Sofia-sip-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel Confidentiality Notice: This e-mail message including attachments, if any, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. If you are the intended recipient, but do not wish to receive communications through this medium, please so advise the sender immediately. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel