Question

I want to run a process that checks my key press state, parallel to my existing infinite loop (from pcap header). I was looking something very similar to GetAsyncKeyState that of Windows.

I tried for a whole week and found its hard to program something similar to GetAsyncKeyState. So, I was using Termination Signal like ctrl+c to perform certain operation.

I wanted to know, if there are some other similar Termination signals that I can catch using program to perform operation of my own?

P.S. I'm a beginner for Linux and C++. Sorry, if my question is stupid.

Was it helpful?

Solution

POSIX makes SIGUSR1 and SIGUSR2 available for application use. Additionally there are the set of realtime signals. A close reading of man (7) signal should provide the basics and ample reference material is available on the web.

That said, it sounds like you are headed toward expanding what is already an awkward hack. Perhaps you should ask a separate question detailing exactly what you are doing and someone can help you with a more appropriate path toward solving your primary problem rather than improvements on a work-around.

OTHER TIPS

you can catch the pid (Process identifier of your program) and with another terminal put kill -9 {pid}

to get the pid just type in terminal ps -u {username}

or you can open application monitor (it's like the task admin of windows)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top