Andrea
2003-12-02 16:08:52 UTC
Hi,
I am working on a C application that has to run on Windows, Linux, Sun
and HP. This application has to start the Acrobat Reader to show some
pdf help files. On windows, it is running know, but I am not so good
on the unix process model.
The following code starts the Acrobat Reader:
void OpenHelpfile()
{
int pid, ret;
if (pid=fork())
{
return;
}
else
{
ret = execl("/home/as12242/Acrobat5/bin/acroread","acroread",NULL);
}
}
But then my problems begin:
1. the user can open a helpfile very often, and as I understand fork,
there is always created a copy of my current process - that might be
very memory intensive with the 10th help file!
2. my idea on problem 1 is to find out if acrobat is alreay running,
and only if not, I call fork. Is there something like:
if (findProcess(childPID) == false)
{
fork
exec(acroread)
}
3. and what is about pthread - might this be a alternative to fork? Is
there any useful documentation on the internet or in a book? I need
some background and concept know-how about these functions and some
good examples on how to use them. getting fork and exec running only
with man-pages is very hard!
Thanks for any help!
Andrea
I am working on a C application that has to run on Windows, Linux, Sun
and HP. This application has to start the Acrobat Reader to show some
pdf help files. On windows, it is running know, but I am not so good
on the unix process model.
The following code starts the Acrobat Reader:
void OpenHelpfile()
{
int pid, ret;
if (pid=fork())
{
return;
}
else
{
ret = execl("/home/as12242/Acrobat5/bin/acroread","acroread",NULL);
}
}
But then my problems begin:
1. the user can open a helpfile very often, and as I understand fork,
there is always created a copy of my current process - that might be
very memory intensive with the 10th help file!
2. my idea on problem 1 is to find out if acrobat is alreay running,
and only if not, I call fork. Is there something like:
if (findProcess(childPID) == false)
{
fork
exec(acroread)
}
3. and what is about pthread - might this be a alternative to fork? Is
there any useful documentation on the internet or in a book? I need
some background and concept know-how about these functions and some
good examples on how to use them. getting fork and exec running only
with man-pages is very hard!
Thanks for any help!
Andrea