- Subject: [slang-users] need to send signals two times
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- Date: Sat, 28 Apr 2007 21:40:00 +0000 (UTC)
Hi,
variable quit = 0;
define sig_handler(sig)
{
quit = 1;
message("got signal $sig"$);
}
signal(SIGHUP, &sig_handler);
signal(SIGINT, &sig_handler);
signal(SIGQUIT, &sig_handler);
variable fifo_name = "/tmp/jed.latex." + string(getpid());
if (mkfifo(fifo_name, 0600) != 0)
throw ApplicationError, "Could not create FIFO";
message(fifo_name);
try
{
message("before fopen");
variable fifo = fopen(fifo_name, "r");
message("after fopen");
if (quit)
{
if (fifo != NULL)
fclose(fifo);
break;
}
}
finally
() = remove(fifo_name);
run it with slsh /tmp/test.sl and hit ^C. At me, I have to hit a second
time ^C to get the output “got signal 2”.
% slsh --version
slsh version 0.7.5-0
S-Lang Library Version: 2.0.6
Bye, Jörg.
--
Mancher Hahn meint, dass die Sonne seinetwegen aufgeht.
(Theodor Fontane)
[2007 date index]
[2007 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]