Welcome, Guest. Please login or register.

Author Topic: CreateNewProc() task termination  (Read 1864 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline jahcTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 521
    • Show only replies by jahc
    • http://wookiechat.amigarevolution.com
CreateNewProc() task termination
« on: June 22, 2003, 02:14:53 AM »
I've created a task with CreateNewProcTags() .. I want to be able to terminate it from another task.. is there a way to do this? Without the task ending by itself?

 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: CreateNewProc() task termination
« Reply #1 on: June 22, 2003, 11:50:31 AM »
RemTask((struct Task *) DaProc);

However, this is very bad idea unless if the running process is in a known state. If the process has allocated some resources, those resources will not be released.

It is always better to signal the process to terminate, that way it can do the cleanup as needed.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: CreateNewProc() task termination
« Reply #2 on: June 22, 2003, 11:54:45 AM »
Never abitrarily remove a thread. You should let it finish via a return from the entry function you used (just as a normal program returns from main).

As piru says, use a signalling policy. When your thread receives the appropriate signal it should finish up and clean up after itself.
int p; // A