All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [patch] fix rt_task_delete for cancellable rt-threads
@ 2005-12-08 18:42 Jan Kiszka
  2005-12-09 19:57 ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2005-12-08 18:42 UTC (permalink / raw)
  To: xenomai-core


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

Hi,

no, this is not the fix for the issue I described earlier. This just
improves the behaviour of rt_task_delete in case the target is blocking
at a cancellation point (tested with standard sem_wait). With the
current version, rt_task_deletes the rt-shadow and just wakes up the
linux pthread even if the target is cancellable at that moment. With the
reordering, this is fixed and the target is actually terminated. No
major issue, though.

Jan

[-- Attachment #1.2: rt_task_delete.patch --]
[-- Type: text/plain, Size: 679 bytes --]

Index: src/skins/native/task.c
===================================================================
--- src/skins/native/task.c	(revision 243)
+++ src/skins/native/task.c	(working copy)
@@ -203,12 +203,18 @@
 int rt_task_delete (RT_TASK *task)
 
 {
-    int err = XENOMAI_SKINCALL1(__native_muxid,
-				__native_task_delete,
-				task);
-    if (!err)
-	pthread_cancel((pthread_t)task->opaque2);
+    int err;
 
+    err = pthread_cancel((pthread_t)task->opaque2)
+    if (err)
+        return -err;
+
+    err = XENOMAI_SKINCALL1(__native_muxid,
+			    __native_task_delete,
+			    task);
+    if (err == -ESRCH)
+	return 0;
+
     return err;
 }
 

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

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

* Re: [Xenomai-core] [patch] fix rt_task_delete for cancellable rt-threads
  2005-12-08 18:42 [Xenomai-core] [patch] fix rt_task_delete for cancellable rt-threads Jan Kiszka
@ 2005-12-09 19:57 ` Jan Kiszka
  2005-12-10 14:52   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2005-12-09 19:57 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai-core

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

Jan Kiszka wrote:
> Hi,
> 
> no, this is not the fix for the issue I described earlier. This just
> improves the behaviour of rt_task_delete in case the target is blocking
> at a cancellation point (tested with standard sem_wait). With the
> current version, rt_task_deletes the rt-shadow and just wakes up the
> linux pthread even if the target is cancellable at that moment. With the
> reordering, this is fixed and the target is actually terminated. No
> major issue, though.
> 
> Jan
> 
> 
> ------------------------------------------------------------------------
> 
> Index: src/skins/native/task.c
> ===================================================================
> --- src/skins/native/task.c	(revision 243)
> +++ src/skins/native/task.c	(working copy)
> @@ -203,12 +203,18 @@
>  int rt_task_delete (RT_TASK *task)
>  
>  {
> -    int err = XENOMAI_SKINCALL1(__native_muxid,
> -				__native_task_delete,
> -				task);
> -    if (!err)
> -	pthread_cancel((pthread_t)task->opaque2);
> +    int err;
>  
> +    err = pthread_cancel((pthread_t)task->opaque2)
> +    if (err)
> +        return -err;
> +
> +    err = XENOMAI_SKINCALL1(__native_muxid,
> +			    __native_task_delete,
> +			    task);
> +    if (err == -ESRCH)
> +	return 0;
> +
>      return err;
>  }
>  

Oops, fix for my patch:

--- ../src/skins/native/task.c  (Revision 251)
+++ ../src/skins/native/task.c  (Arbeitskopie)
@@ -206,7 +206,7 @@
 {
     int err;

-    err = pthread_cancel((pthread_t)task->opaque2)
+    err = pthread_cancel((pthread_t)task->opaque2);
     if (err)
         return -err;


I reorganised the code without a compiler run before posting.

Jan

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

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

* Re: [Xenomai-core] [patch] fix rt_task_delete for cancellable    rt-threads
  2005-12-09 19:57 ` Jan Kiszka
@ 2005-12-10 14:52   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2005-12-10 14:52 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai-core


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

Hi Philippe,

really hope we can close this issue soon, but I managed to add another
regression with my fix (rt_task_delete(NULL) caused seg-faults, e.g. in
latency). Please apply the attached path against current SVN.

Jan

[-- Attachment #1.2: rt_task_delete.patch.fix --]
[-- Type: text/plain, Size: 494 bytes --]

Index: src/skins/native/task.c
===================================================================
--- src/skins/native/task.c	(Revision 251)
+++ src/skins/native/task.c	(Arbeitskopie)
@@ -206,9 +206,11 @@
 {
     int err;
 
-    err = pthread_cancel((pthread_t)task->opaque2)
-    if (err)
-        return -err;
+    if (task) {
+	err = pthread_cancel((pthread_t)task->opaque2);
+	if (err)
+	    return -err;
+    }
 
     err = XENOMAI_SKINCALL1(__native_muxid,
 			    __native_task_delete,

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

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

end of thread, other threads:[~2005-12-10 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 18:42 [Xenomai-core] [patch] fix rt_task_delete for cancellable rt-threads Jan Kiszka
2005-12-09 19:57 ` Jan Kiszka
2005-12-10 14:52   ` Jan Kiszka

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.