Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting child's task id at exit time

202 views
Skip to first unread message

Jens Christensen

unread,
Oct 5, 1994, 9:44:45 PM10/5/94
to
Under VxWorks, when task deletion hooks get called taskIdSelf()
seems to return the taskid of the parent, and not of the child
task that is exiting and on whose behalf cleanup should be done.

Is there any way of obtaining the task id of the exiting
task?

Thanks,

Jens

Matthew Krokosz

unread,
Oct 6, 1994, 9:46:16 AM10/6/94
to

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. Take a look at the structure,
I think it is in taskLib.h.


*************************************************************************
| Matthew Krokosz email: mkro...@astro.ge.com |
| Martin Marietta Astro Space phone: (609) 490-7194 |
| Princeton, NJ |
*************************************************************************

Jason J Wang

unread,
Oct 6, 1994, 7:05:39 PM10/6/94
to
Jens Christensen (je...@Xenon.Stanford.EDU) wrote:
: Under VxWorks, when task deletion hooks get called taskIdSelf()

: 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

Per Hedeland

unread,
Oct 9, 1994, 7:23:03 AM10/9/94
to
In article <jens.78...@Xenon.Stanford.EDU> je...@Xenon.Stanford.EDU (Jens Christensen) writes:
>Under VxWorks, when task deletion hooks get called taskIdSelf()
>seems to return the taskid of the parent, and not of the child
>task that is exiting and on whose behalf cleanup should be done.

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

Andy Kozubal

unread,
Oct 11, 1994, 3:25:58 PM10/11/94
to
Jens Christensen writes:
>Under VxWorks, when task deletion hooks get called taskIdSelf()
>seems to return the taskid of the parent, and not of the child
>task that is exiting and on whose behalf cleanup should be done.

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
-----------------------------------------------------------------------

0 new messages