Philippe,
There is one correction in the following patch. Though you told me uncompiled / 
untested, I just want to give a try and found minor compilation issue which I 
want to bring to your notice.

- tid = (pthread_t)desc->td_opaque;
+ tid = (pthread_t)desc.td_opaque;

After this correction compilation went well. I also tested with  our ported 
software. It works as expected with taskDelete from Xenomai.

One more observation that I remember now:-
In legacy VxWorks code we create Queues of size 1000  to store each message of 
size 384bytes while we have memory on our Boards upto 4GB, but with Xenomai I 
**have to** reduce the queue size drastically otherwise msgQCreate fails(though 
we have memory) with error code S_memLib_NOT_ENOUGH_MEMORY.

Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 22:36
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

On Thu, 2011-09-01 at 22:27 +0200, Philippe Gerum wrote:
> On Thu, 2011-09-01 at 17:25 +0200, Sambasiva Rao Manchili wrote:
> > Hi,
> > It is reduced piece which explains the problem.
> > If it is much more then I will see what I can do.
>
> User-space needs this, or something alike (not tested, not even
> compiled actually):

Keep in mind that the following hack bypasses the safe lock mechanism totally, 
a complete and sane fix would need a bit more thought, and maybe an ABI 
breakage. Normally we should not throw pthread_cancel() at a task denying 
deletion from within a taskSafe() section, unless we pair this with proper 
cancellation deferral.

>
> diff --git a/src/skins/vxworks/taskLib.c b/src/skins/vxworks/taskLib.c
> index f751788..70f33aa 100644
> --- a/src/skins/vxworks/taskLib.c
> +++ b/src/skins/vxworks/taskLib.c
> @@ -267,10 +267,34 @@ STATUS taskDeleteForce(TASK_ID task_id)
>
>  STATUS taskDelete(TASK_ID task_id)
>  {
> +     TASK_DESC desc;
> +     pthread_t tid;
>       int err;
>
> -     err =
> -         XENOMAI_SKINCALL1(__vxworks_muxid, __vxworks_task_delete, task_id);
> +     err = XENOMAI_SKINCALL2(__vxworks_muxid,
> +                             __vxworks_taskinfo_get, task_id, &desc);
> +     if (err) {
> +             errno = abs(err);
> +             return ERROR;
> +     }
> +
> +     tid = (pthread_t)desc->td_opaque;
> +     if (tid == pthread_self()) {
> +             /* Silently migrate to avoid raising SIGXCPU. */
> +             XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
> +             pthread_exit(NULL);
> +     }
> +
> +     if (tid) {
> +             err = pthread_cancel(tid);
> +             if (err)
> +                     return -err;
> +     }
> +
> +     err = XENOMAI_SKINCALL1(__vxworks_muxid, __vxworks_task_delete, 
> task_id);
> +     if (err == S_objLib_OBJ_ID_ERROR)
> +             return OK; /* Used to be valid, but has exited. */
> +
>       if (err) {
>               errno = abs(err);
>               return ERROR;
>
> > Samba.
> >
> > -----Original Message-----
> > From: Gilles Chanteperdrix [mailto:[email protected]]
> > Sent: Thursday, 01. September, 2011 17:08
> > To: Sambasiva Rao Manchili
> > Cc: [email protected]
> > Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?
> >
> > On 09/01/2011 04:51 PM, Sambasiva Rao Manchili wrote:
> > >  Hi,
> > > The reason that I have not given this piece of code was because it is not 
> > > written by me oflate but  was code that exists since several years which 
> > > is running on VxWorks  on  different versions.
> > > I just ported this with very very minimal effort to Linux over Xenomai.
> > >
> >
> > I do not ask you to send your code, I ask you to send a reduced, 
> > self-contained test case, which demonstrates the issue you have, for 
> > reasons explained on the page I directed you to.
> >
> > --
> >                                             Gilles.
> >
> >
> > This email and any attachment may contain confidential information which is 
> > intended for use only by the addressee(s) named above. If you received this 
> > email by mistake, please notify the sender immediately, and delete the 
> > email from your system. You are prohibited from copying, disseminating or 
> > otherwise using the email or any attachment.
> >
> >
> > _______________________________________________
> > Xenomai-help mailing list
> > [email protected]
> > https://mail.gna.org/listinfo/xenomai-help
>

--
Philippe.




This email and any attachment may contain confidential information which is 
intended for use only by the addressee(s) named above. If you received this 
email by mistake, please notify the sender immediately, and delete the email 
from your system. You are prohibited from copying, disseminating or otherwise 
using the email or any attachment.


_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to