All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] fix pthread cancellation in native skin
Date: Sat, 28 Jan 2006 10:34:41 +0100	[thread overview]
Message-ID: <43DB3AB1.5090004@domain.hid> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 753 bytes --]

Hi,

Gilles' work on cancellation for the posix skin reminded me of this
issue I once discovered in the native skin:

https://mail.gna.org/public/xenomai-core/2005-12/msg00014.html

I found out that this can easily be fixed by switching the pthread of a
native task to PTHREAD_CANCEL_ASYNCHRONOUS. See attached patch.


At this chance I discovered that calling rt_task_delete for a task that
was created and started with T_SUSP mode but was not yet resumed, locks
up the system. More precisely: it raises a fatal warning when
XENO_OPT_DEBUG is on. Might be the case that it just works on system
without this switched on. Either this is a real bug, or the warning
needs to be fixed. (Deleting a task after rt_task_suspend works.)

Jan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: native-canceltype.patch --]
[-- Type: text/x-patch; name="native-canceltype.patch", Size: 813 bytes --]

Index: src/skins/native/task.c
===================================================================
--- src/skins/native/task.c	(Revision 481)
+++ src/skins/native/task.c	(Arbeitskopie)
@@ -59,6 +59,9 @@
     param.sched_priority = sched_get_priority_max(SCHED_FIFO);
     pthread_setschedparam(pthread_self(),SCHED_FIFO,&param);
 
+    /* rt_task_delete requires asynchronous cancellation */
+    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
     signal(SIGCHLD,&rt_task_sigharden);
 
     bulk.a1 = (u_long)iargs->task;
@@ -160,6 +163,9 @@
 {
     struct rt_arg_bulk bulk;
 
+    /* rt_task_delete requires asynchronous cancellation */
+    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
     signal(SIGCHLD,&rt_task_sigharden);
 
     bulk.a1 = (u_long)task;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

             reply	other threads:[~2006-01-28  9:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-28  9:34 Jan Kiszka [this message]
2006-01-28 10:25 ` [Xenomai-core] [PATCH] fix pthread cancellation in native skin Gilles Chanteperdrix
2006-01-30 11:34 ` Gilles Chanteperdrix
2006-02-01 12:31   ` Gilles Chanteperdrix
2006-02-01 18:23     ` Philippe Gerum
2006-02-01 19:07       ` Philippe Gerum
2006-02-03 16:21         ` Gilles Chanteperdrix

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=43DB3AB1.5090004@domain.hid \
    --to=jan.kiszka@domain.hid \
    --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.