Gilles Chanteperdrix wrote:
> On Dec 6, 2007 2:28 PM, Gilles Chanteperdrix
> <[EMAIL PROTECTED]> wrote:
>> On Dec 6, 2007 2:24 PM, Wolfgang Grandegger <[EMAIL PROTECTED]> wrote:
>>> Gilles Chanteperdrix wrote:
>>>> On Dec 6, 2007 1:31 PM, Wolfgang Grandegger <[EMAIL PROTECTED]> wrote:
>>>>> Hello,
>>>>>
>>>>> how do I cancel or delete a Xenomai POSIX thread running in primary
>>>>> context from a higher priority thread? IIUC, pthread_kill() can only be
>>>>> used in secondary context. I tried pthread_cancel(), but it only works
>>>>> when hitting a cancelation point, e.g. pthread_testcancel(). Setting
>>>>> pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS) did not help. Is
>>>>> there a code snippet or even an example program showing how to cancel a
>>>>> pthread in primary context?
>>>> pthread_kill or pthread_cancel should result in sending a signal to
>>>> the target thread, so should cause this thread to switch to secondary
>>>> mode to handle it. If you want to wait for the target thread to be
>>>> canceled, you should use pthread_cancel and pthread_join.
>>> There is no way to cancel a pthread in primary mode from another pthread?
>> No. You always need secondary mode to effectively delete a thread. The
>> same goes for the native skin.
> 
> Ok. I understand what you mean. You want pthread_cancel not to leave
> primary mode. This can easily be done by causing pthread_cancel to use
> the kernel-space real-time pthread_cancel service. This should work
> with no further modification.

I want to cancel/delete a task running in primary mode, e.g.

  void* work_task(void* dummy)
  {
        int count = 0;
        while (1)
                count++;
  }

from the outside (= another higher priority task). How can I use the
kernel-space real-time pthread_cancel service? My POSIX app is runs in
user-land.

Wolfgang.


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

Reply via email to