C (147/304)

From:Charlie
Date:16 Aug 2000 at 04:33:30
Subject:Re: RemTask() within own task code.

----- Original Message -----
From: <meyersrl@songs.sce.com>
To: <amiga-c@egroups.com>
Sent: Tuesday, August 15, 2000 12:11 PM
Subject: [amiga-c] RemTask() within own task

>
>
> To: amiga-c@egroups.com
> cc:
> Subject: Re: [amiga-c]
RemTask() within own
> task code.
>
>
>
>
>
>
>
> >Hi,
> > Is it legal fro a spawned task to remove itself via RemTask()
> >within
> >its own taskcode.
> >
>
> >Yes, and I think it mentions doing this in the RKMs too.
>
> Yep, see exec.library/RemTask()
>
> Briefly:
>
> 1. Deallocate all resources that the task set up for itself such as
> local memory, Signals, MsgPorts, Devices, libraries etc..
>
> 2. Call RemTask(0L); This should cause the Task to remove itself and
> deallocate any remaining memory including the memory holding the Task
> structure itself.
>
> Note: Be careful the Task is not doing something that could cause another
> Task to Signal it after it is gone.
>
> Bob Meyers

I think Ive got it working ok.

I do this:

In the main program

struct Task *Subtask = CreateTask(etc, etc...);

Then in the Task Code

DeleteTask(SubTask);

There is no problems, well some but I dont think its to do with the task.

Thanks

Cheers
Charlie