[slang-users] need to send signals two times
Jörg Sommer
joerg at alea.gnuu.de
Sat Apr 28 17:40:00 EDT 2007
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)
More information about the slang-users-l
mailing list