Dmitry Adamushko wrote:
> --- task.c      2006-05-19 18:25:19.000000000 +0200
> +++ task-my.c   2006-07-12 15:40:16.549170000 +0200
> @@ -426,7 +426,8 @@ int rt_task_suspend(RT_TASK *task)
>         goto unlock_and_exit;
>     }
> 
> 
> -    if (xnpod_unblockable_p()) {
> +    /* we are about to suspend a task, let's check wehther it may sleep */
> +    if (xnthread_test_flags(task, XNLOCK|XNROOT)) {
>         err = -EPERM;
>         goto unlock_and_exit;
>     }
> 
> 
> 
> See the difference? :) it was slightly broken indeed, meaning it just
> bailed
> out all the calls from the interrupt context which is wrong according to
> spec.

Fine, now I achieved what I always wanted: someone really thought about
it! :)

I tried to bundle your approach with appropriate documentation update
and a minor fix in the attached patch. Credits go to you then.

> 
> maybe something like xnthread_task_unblockable/blockable(task)  would be
> also of avail.
> 
> 
> Oh, my dear. I should stop hacking patches while talking to colleagues.
>> Does this one make more sense?
>>
> 
> maybe it's better that the other way around? I mean, writting good code and
> saying nonsense to your collegues... :o>

Who said I was talking witted stuff to them?

Jan
Index: ksrc/skins/native/task.c
===================================================================
--- ksrc/skins/native/task.c    (revision 1323)
+++ ksrc/skins/native/task.c    (working copy)
@@ -391,9 +391,8 @@ int rt_task_start(RT_TASK *task, void (*
  *
  * - -EINVAL is returned if @a task is not a task descriptor.
  *
- * - -EPERM is returned if @a task is NULL but not called from a task
- * context, or this service was called from a context which cannot
- * sleep (e.g. interrupt, non-realtime or scheduler locked).
+ * - -EPERM is returned if the addressed @a task is not allowed to sleep
+ * (e.g. in interrupt context, non-realtime task, or scheduler locked).
  *
  * - -EIDRM is returned if @a task is a deleted task descriptor.
  *
@@ -432,7 +431,8 @@ int rt_task_suspend(RT_TASK *task)
                goto unlock_and_exit;
        }
 
-       if (xnpod_unblockable_p()) {
+       /* We are about to suspend a task, let's check whether it may sleep */
+       if (xnthread_test_flags(&task->thread_base, XNLOCK|XNROOT)) {
                err = -EPERM;
                goto unlock_and_exit;
        }

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to