Signals

From: Chris Johnson (effigies_at_gmail.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 16:34:03 -0600

I wrote a prime generator just for fun, but I really like it and it
scrolls on my desktop as I generate them (which is just neat), so I'm
blowing this tiny project up into a big one to teach myself more C. What
with 1.7 billion primes, it doesn't make sense to run through them all to
count and find the last one every time. So yesterday I added --kill
support, so that it saves its progress (current prime and number of
primes) and exits gracefully. How I do this is by creating a "killer" file
that the program checks for every time through the main loop, and then
cleans up after itself. This has halved my speed, and is clearly not a
particularly elegant solution.

However, in the process of getting the --kill argument working, I tried to
use the kill() function, but it didn't allow for very nice exits. I looked
through whatever I could find on signal.h to see if I could send a signal
that it checks for, rather than a file. I believe it should be possible,
as the kill signal could be sent to a process, to send a custom signal
that it handles beautifully. Does anybody know of a way to do this or a
good resource on signals?

Thanks,
Chris



Relevant Pages

  • Re: Wi-Fi question
    ... > They build or buy antennas that can pick up the signal. ... > around and detect signals so they would not have to live close by. ... for other wardrivers to check out. ... Of course, they also think geocacheing is fun, so ... ...
    (comp.sys.mac.system)
  • Re: Using Counter IC
    ... > I want to count 5 signals which have a interval of 99hrs between each of> them. ... And give an high output after 5 counts. ... Have Fun! ...
    (sci.electronics.design)