06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pSOS+ <strong>System</strong> <strong>Calls</strong> t_delete<br />

Notes<br />

1. If the call is to delete self (suicide via tid equal to 0), there will be no return.<br />

2. Task deletion should be carefully planned and considered. Indiscriminate use<br />

can lead to unpredictable results, especially when resources such as allocated<br />

memory segments, buffers, or semaphores have not been correctly returned. If a<br />

task holds any resources from the pREPC+ library, the pHILE+ file system<br />

manager, or the pNA+ network manager, those resources must be returned<br />

before t_delete() is called. The commands that must be executed for<br />

pREPC+, pHILE+, and pNA+ resources are fclose(0), close_f(0), and<br />

close(0), respectively. Following these commands, a free() command must<br />

be used to return pREPC+ memory. This order of execution is required because<br />

the pREPC+ library calls the pHILE+ file system manager, and the pHILE+ file<br />

system manager calls the pNA+ network manager (if NFS is in use.) If resources<br />

are not returned in the correct order, an error occurs. See Error Codes.<br />

The following is an example of the correct sequence of calls for returning resources.<br />

This example applies to a case where all three components have allocated<br />

resources:<br />

fclose(0); /* return pREPC+ resources */<br />

close_f(0); /* return pHILE+ resources */<br />

close(0); /* return pNA+ resources */<br />

free(-1) /* return pREPC+ memory */<br />

t_delete(0); /* and execute self-deletion */<br />

3. Using t_delete() to delete another task does not generally allow that task a<br />

chance to perform any cleanup work necessary for the orderly termination of<br />

the task. In general, t_delete() should be used for self-deletion, whereas<br />

asynchronous deletion of another task can best be achieved using the<br />

t_restart() call.<br />

4. t_delete() calls the optional user-supplied callout procedure, whose address<br />

is defined in the kc_deleteco entry in the pSOS+ Configuration Table.<br />

Multiprocessor Considerations<br />

1. A task can be deleted only from the local node.<br />

2. If tid identifies a global task, t_delete notifies the master node so that the<br />

task can be removed from its Global Object Table. Thus, deletion of a global<br />

task always causes activity on the master node.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 1-139<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!