Helping ordinary people create extraordinary websites!

Port Windows IPC Apps to Linux, Part 1: Processes and Threads

By Srinivasan S. Muthuswamy, Kavitha Varadarajan
2005-06-16

Exiting a process
Exiting a process means a graceful exiting of the process with a proper cleanup. In Windows, you use ExitProcess() to perform this operation.


VOID ExitProcess(
UINT uExitCode // exit code for all threads
);

ExitProcess() is the preferred method of ending a process. This function provides a clean process shutdown. This includes calling the entry-point function of all attached dynamic-link libraries (DLLs) with a value indicating that the process is detaching from the DLL.

The Linux equivalent for ExitProcess() is exit(): void exit(int status);.

The exit() function causes normal program termination and the value of status &0377 is returned to the parent. The C standard specifies two definitions (EXIT_SUCCESS and EXIT_FAILURE) that can be passed to the status parameter to indicate successful or unsuccessful termination.





Tutorial pages:

First published by IBM DeveloperWorks


 3 Votes

You might also want to check these out:


Leave a Comment on "Port Windows IPC Apps to Linux, Part 1: Processes and Threads"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS