overriding SIGINT
Hello everyone,
i am writing a program uses shared memory with semaphores and i use fork() mechanism for child process.
My program will run until the user hits ctrl+C.
But when it is hit, i must stop the child process, detach and deallocate the shared memory and then exit. How can i achieve this?
i tried signal and defined a handler function but i cannot pass any other necessary arguments to it. It takes only one int signum. Do u have any suggestions?
Thanks in advance.
|