Hello, Thank you for the good information. Your suggestion sounds good. Do you have an example (or can point me to documentation) on how to register a local pipe to the su_root() thread that can later be used to wake the sofia-sip thread from su_root_run()?
Best Regards, Jerry -----Original Message----- From: Kai Vehmanen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 02, 2007 12:39 PM To: Jerry Richards Cc: sofia-sip-devel@lists.sourceforge.net Subject: Re: [Sofia-sip-devel] 1.12.6 Application Interface Hi, On Tue, 2 Oct 2007, Jerry Richards wrote: > Currently, with 1.12.4, my call control application thread handles messages > from other application threads that include removing/adding new lines (i.e. > multiple NUAs). If it is now a 1.12.6 requirement that the su_root_ thread > calls nua_create(), how would my call control thread communicate to the > su_root_ thread to later invoke nua_create()? [...] > I don't understand this new 1.12.6 design. My current application design is > the result of guidance received via this mailing list. I haven't followed this thread from the start, so my apologies if I've missed something, but there seems to have been some confusion: Sofia-SIP is an event-driven library where you can have multiple event loops, but each of those has to be accessed from at most one thread. So if you have a multithreaded application, you can: - run multiple separate nua instance (with their own su_root), one per thread, or - have multiple threads, but concentrate all access to nua objects (sharing a single su_root) to a single thread Now with your current design, su_root_run() might trigger calls to nua code (from timers, network i/o, etc), while you could be at the same time calling nua functions from other threads. This leads to potentially entering the event loop in multiple places, and this is not supported (and can lead to hard to debug errors). 1.12.4 allowed you to create the su_root object in one thread, and then run it in another. This was changed in 1.12.6. But even with 1.12.4, you weren't supposed to access nua objects from two threads at the same time! This hasn't changed since 1.12.4 AFAIK. > Perhaps there is a patch for 1.12.6 so that I can preserve my application as > shown below? That is, I invoke nua_create/nua_destroy from my main > application thread, and call su_root_run() from a separate thread, as shown > below. This approach breaks the event loop model and can lead to errors (as your code not only creates the nua object, but also accesses it from multiple threads at the same time). What you could do instead (one approach): - have one thread communicate with the sofia nua API (if multiple nua objects, use a single su_root for all ->single event loop) - provide a mutex protected API to communicate with this thread from other parts of your application - use a local pipe (registered to su_root()) to wake the sofia-sip thread from su_root_run() when you have to handle requests from your other threads - once all requests are processed, continue running su_root_run() in the sofia-sip thread - you can freely submit requests to Sofia-SIP from any thread of your program -- under work: Sofia-SIP at http://sofia-sip.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel