Hello everyone,
I have two problems related to shutting down sofia stack.

In my application I create a separate thread that does the stack 
initialization and runs the event loop. That's how I do it:

su_init();
su_root_create(instance->root);
nua_create(instance->root, ...); <- this is where the 
su_pthread_port_clone_main is started
nua_set_params();
while (true)
{
  su_root_step (instance->root, 100);
  if (terminate)
  {
    event->reset();
    nua_shutdown(instance->nua);
    su_root_step(instance->root, 500);
    event->wait(500);
    nua_destroy(instance->nua);
    break;
  }
}
su_root_destroy (instance->root);
su_deinit();

Problem 1)
When the stack should end, I run that ugly piece of code, that calls 
nua_sutdown(), does su_root_step() to receive the nua_r_shutdown event 
and then calls nua_destroy(). However, even if I receive the 
nua_r_shutdown event, nua_destroy() reports: FATAL: nua_shutdown not 
completed.
What is the clean way to handle this? And what else is needed for 
nua_shutdown() to be successfull?

Problem 2)
After calling the su_root_destroy() and su_deinit() the 
su_pthread_port_clone_main is still running and waiting inside su_wait() 
function. This leads to access violations whenever I try to unload sofia 
library before shutting down the program.
su_root_destroy() documentation states that I should not call it from 
cloned task. Is this the case? And if not, why does it fails to stop the 
thread?

Any help is much appreciated
Thanks in advance

Martin

-- 
  Martin Drasar, Developer / Analyst
  OptimSys, s.r.o.
  [EMAIL PROTECTED]
  Tel: +420 541 143 065
  Fax: +420 541 143 066
  http://www.optimsys.cz


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to