From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: "Stéphane ANCELOT" <sancelot@free.fr>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] safely terminate application
Date: Tue, 10 Nov 2015 11:21:03 +0100 [thread overview]
Message-ID: <20151110102103.GA11824@hermes.click-hack.org> (raw)
In-Reply-To: <5641A442.80201@free.fr>
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
prev parent reply other threads:[~2015-11-10 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 8:01 [Xenomai] safely terminate application Stéphane ANCELOT
2015-11-10 10:21 ` Gilles Chanteperdrix [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151110102103.GA11824@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=sancelot@free.fr \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.