All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] safely terminate application
@ 2015-11-10  8:01 Stéphane ANCELOT
  2015-11-10 10:21 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 2+ messages in thread
From: Stéphane ANCELOT @ 2015-11-10  8:01 UTC (permalink / raw)
  To: xenomai

Hi,

I have got some problems terminating my RT application, I have very 
strange behavours.
either locking application, either TERMINATE signal does not seem being 
propagated.

I am using a SIGTERM handler to call a cleanup func to delete everything.

I noticed that if I delete nothing , it seems to quit fine (altough 
there may be lot of memory leaks,etc...)

Unfortunately, I don't have the problem using a small regression test 
... my problem concerns a real life application, with rt_tasks, 
rt_pipes, mutex,rtdm driver ...

At initialisation of program I am loading an xmlfile using libxml2 api. 
I strongly suspect  this library being intrusive, since it modifiess 
some signals, is using mutexes....and may have an impact in
the way my application quits.
http://www.xmlsoft.org/threads.html

if some people have any idea on how I could deal with this problem...

Regards,
Steph




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai] safely terminate application
  2015-11-10  8:01 [Xenomai] safely terminate application Stéphane ANCELOT
@ 2015-11-10 10:21 ` Gilles Chanteperdrix
  0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2015-11-10 10:21 UTC (permalink / raw)
  To: Stéphane ANCELOT; +Cc: xenomai

On Tue, Nov 10, 2015 at 09:01:06AM +0100, Stéphane ANCELOT wrote:
> Hi,
> 
> I have got some problems terminating my RT application, I have very 
> strange behavours.
> either locking application, either TERMINATE signal does not seem being 
> propagated.
> 
> I am using a SIGTERM handler to call a cleanup func to delete everything.

This is a bad solution. Most functions, including cleanup functions
like, say, pthread_mutex_destroy, are not "async-signal-safe", they
can not be called from the context of a signal handler. For this
reason, using signals with threaded applications is hard to get
right.

For instance, the "printf" function uses a mutex to protect
concurrent access to the underlying FILE *. If a signal handler
calls printf on a thread which had the mutex locked because it was
in the middle of a printf, you get a deadlock.


> 
> I noticed that if I delete nothing , it seems to quit fine (altough 
> there may be lot of memory leaks,etc...)

No, there will not be any memory leak. The memory reserved by an
application is automatically returned to the system when the
application terminates. On the Xenomai side, all Xenomai objects
created by your application are destroyed automatically.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-10 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  8:01 [Xenomai] safely terminate application Stéphane ANCELOT
2015-11-10 10:21 ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.