next up previous contents
Next: 10.4 Process Management Commands Up: 10 Multi-Tasking Previous: 10.2 Creating New Processes

10.3 Destroying Processes

The kill_process function is used to destroy processes. Processes are destroyed by passing their process ID number to kill_process, according to the following syntax:

int kill_process(int pid)

kill_process returns a value indicating if the operation was successful. If the return value is 0, then the process was destroyed. If the return value is 1, then the process was not found.

The following code shows the main process creating a

check_sensor process, and then destroying it one second later:

    void main()
    {
      int pid;

      pid= start_process(check_sensor(2));
      sleep(1.0);
      kill_process(pid);
    }



Fred G. Martin
Fri Mar 29 17:44:15 EST 1996