Signals
From: Chris Johnson (effigies_at_gmail.com)
Date: 11/29/04
- Next message: David White: "Re: (OT) Re: Microsoft C version 1.52"
- Previous message: Old Wolf: "Re: Screen Colour combinations"
- Next in thread: Alwyn: "Re: Signals"
- Reply: Alwyn: "Re: Signals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: David White: "Re: (OT) Re: Microsoft C version 1.52"
- Previous message: Old Wolf: "Re: Screen Colour combinations"
- Next in thread: Alwyn: "Re: Signals"
- Reply: Alwyn: "Re: Signals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|