Is there any way of obtaining the task id of the exiting
task?
Thanks,
Jens
*************************************************************************
| Matthew Krokosz email: mkro...@astro.ge.com |
| Martin Marietta Astro Space phone: (609) 490-7194 |
| Princeton, NJ |
*************************************************************************
: Thanks,
: Jens
The task deletion hook can be called with one argument, WIND_TCB *Tcb
i.e. del_hook (WIND_TCB *Tcb)
What I've used in the past is a kluge of sorts. The task id of the child
task is effectively taskNameToId(*Tcb->name).
Hope this helps!
-Jason
Not really, strictly speaking VxWorks tasks don't have children or
parents - however it is correct that the delete hook is not normally
(ever?) called in the context of the exiting task, thus taskIdSelf()
is not useful.
In article <1994100613...@a9926.ASTRO.GE.COM> Matthew Krokosz <mkro...@astro.ge.com> writes:
>When a task delete hook routine is called, vxworks passes it a pointer
>to the exiting tasks WIND_TCB, which is the task control block. The
>WIND_TCB structure contains the task id.
I certainly can't find it - but the pointer to the WIND_TCB *is* the
task id - i.e. you just need to cast it to int. Although I haven't seen
this documented anywhere, I guess it's unlikely to change anytime
soon... - and as far as I can see, it's the only reasonable/reliable
way to get the exiting task's id in a delete hook.
In article <371vs3$3...@clarknet.clark.net> jjw...@clark.net (Jason J Wang) writes:
>The task deletion hook can be called with one argument, WIND_TCB *Tcb
>i.e. del_hook (WIND_TCB *Tcb)
>
>What I've used in the past is a kluge of sorts. The task id of the child
>task is effectively taskNameToId(*Tcb->name).
(I assume that should be taskNameToId(Tcb->name).) Yes, slow and also
unreliable in general - there is no guarantee that task names are
unique. (int)Tcb works fine.
--Per Hedeland
p...@erix.ericsson.se or
per%erix.eri...@sunic.sunet.se or
...uunet!erix.ericsson.se!per
Normally the delete hook routine gets called in the context of
the task that called taskDelete() or 'td'. However, if a task attempts
to delete itself, the process is handed over to the "ExcTask"
(is this called assisted suicide?). One caveat: the ExcTask
is spawned without the floating point option (VX_FP_TASK).
I use the same delete hook routine to clean up after any number of
related tasks, and I use a linked list to keep track of their task IDs.
-----------------------------------------------------------------------
Andy Kozubal | Mail Stop H820
| Accelerator Operations and Technology
Phone: (505) 667-6508 | Los Alamos National Laboratory
E-mail: AKoz...@lanl.gov | Los Alamos, New Mexico 87545
-----------------------------------------------------------------------