I have a created a program that forks off another program, and maintains status information about each process.
std::map
std::map
for (it = tmpDisplay.begin(); it != tmpDisplay.end(); ++it) {
stringstream filename;
stringstream log;
filename<<"/proc/"<
ifstream file(filename.str().c_str());
if(!file) {
StopOrKillDisplay(it->second, false);
log<<"Removing closed process ("<
Once in a while you come across some information that is pretty interesting. The proc manpage has a lot of good information! Here I am simply inferring that if the directory named from the current pid of the process am interested in does not exist, it is not running. I can then do some cleanup and free those resources maintained by my program.
man proc