C++ via CGI: how to set ignore user abort() ?

Hi all,

I have a C++ application that is hooked up to an Apache server via GET and POST methods (and creates .html via std::cout).

The Apache cgi-script config is

1
2
3
4
#file:httpd.conf
ScriptAlias /cgi-bin/ /home/myprojectname/trunk/Debug

AddHandler cgi-script .cgi .pl .exe



The C++ program is a simple console application residing in the /home/myprojectname/trunk/Debug directory.

Everything works like a charm, except for one thing. On a specific user input, the program creates a large set of files, which takes a long time (as the files are large). If, in the meantime, the user presses the browser stop button, my program aborts having done the files halfway.

I need to ignore the user's pressing of the stop button.

I read posts how to do this using php and a function called ignore_user_abort(). However, I am using C++ and a console application. What should I do?

Thanks for your help!
*****

I am cross-posting with
http://www.webmasterworld.com/apache/4350557.htm
only because I got absolutely no comment on that other forum.



Last edited on
Maybe http://www.cplusplus.com/reference/clibrary/csignal/signal/
However
man 2 signal wrote:
The behavior of signal() varies across Unix versions, and has also varied historically across different versions of Linux. Avoid its use: use sigaction() instead.
The signals SIGKILL and SIGSTOP cannot be caught or ignored.
Last edited on
Thanks for the advice! The references you gave me worked just great!

Just added this only one line of code
signal(SIGABRT,SIG_IGN);
and now it works like a charm :)
Last edited on
Topic archived. No new replies allowed.