Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
March 27, 2003 signals | ||||
---|---|---|---|---|
| ||||
Hi, are there any plans to support signals? I mean, something to handle interrupts and such. Or is something already there? The only way I know to do that is (in C) with signal(), but is it doable in D? By the way, if Windows doesn't send SIGINT to programs, how can I handle Ctrl+C? ------------------------- Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25 |
March 28, 2003 Re: signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | I don't know if catching ctrl+c is such a good idea in windows, at least not if you are planning on using it in the same way it's used in the command line. I think people would get annoyed if their program closed everytime they went to copy a bit of text. That being said, the best way I know how to do it is to use the RegisterHotKey function, then handle the WM_HOTKEY message. i've made a quick and dirty port of signal.h and included it. put it in dmd\src\phobos\c, then use it like this: /+ you probably know how to do this already, but just in case you get bitten by the extern (C) bit like I did <slaps forehead> :-) +/ import c.signal; void main() { signal(SIGINT, &blah); while(1) { } } extern (C) void blah(int sig) { printf("bye"); raise(SIGTERM); } "Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vo8h$2ben$1@digitaldaemon.com... > Hi, are there any plans to support signals? I mean, something to handle interrupts and such. Or is something already there? The only way I know to do that is (in C) with signal(), but is it doable in D? By the way, if Windows doesn't send SIGINT to programs, how can I handle Ctrl+C? > > ------------------------- > Carlos Santander > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25 > > |
March 28, 2003 Re: signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jon Allen Attachments: | uh, oops, this time i'm including it :-) "Jon Allen" <jallen@minotstateu.edu> wrote in message news:b60dj5$2stv$1@digitaldaemon.com... > I don't know if catching ctrl+c is such a good idea in windows, at least not > if you are planning on using it in the same way it's used in the command > line. I think people would get annoyed if their program closed everytime > they went to copy a bit of text. > That being said, the best way I know how to do it is to use the > RegisterHotKey function, then handle the WM_HOTKEY message. > > i've made a quick and dirty port of signal.h and included it. put it in dmd\src\phobos\c, then use it like this: > > /+ > you probably know how to do this already, but just in case you get bitten by > the extern (C) bit like I did <slaps forehead> :-) > +/ > > import c.signal; > > void main() > { > signal(SIGINT, &blah); > while(1) > { > } > } > > extern (C) void blah(int sig) > { > printf("bye"); > raise(SIGTERM); > } > > > "Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vo8h$2ben$1@digitaldaemon.com... > > Hi, are there any plans to support signals? I mean, something to handle interrupts and such. Or is something already there? The only way I know to > > do that is (in C) with signal(), but is it doable in D? By the way, if > > Windows doesn't send SIGINT to programs, how can I handle Ctrl+C? > > > > ------------------------- > > Carlos Santander > > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25 > > > > > > |
March 28, 2003 Re: signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jon Allen | "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje news:b60dj5$2stv$1@digitaldaemon.com... | I don't know if catching ctrl+c is such a good idea in windows, at least not | if you are planning on using it in the same way it's used in the command | line. I think people would get annoyed if their program closed everytime | they went to copy a bit of text. | Well, yes that's what I want: for a console application. (probably I should've specified that before) ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25 |
March 28, 2003 Re: signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jon Allen | "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje news:b60dl6$2sv1$1@digitaldaemon.com... | uh, oops, this time i'm including it :-) | Thanks! This works just fine for me. ————————————————————————— Carlos Santander "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje news:b60dl6$2sv1$1@digitaldaemon.com... | uh, oops, this time i'm including it :-) | Thanks! This works just fine for me. ————————————————————————— Carlos Santander |
March 28, 2003 Re: signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | Glad to hear it. "Carlos Santander B." <carlos8294@msn.com> wrote in message news:b60kik$31hq$1@digitaldaemon.com... > "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje > news:b60dl6$2sv1$1@digitaldaemon.com... > | uh, oops, this time i'm including it :-) > | > > Thanks! This works just fine for me. > > ------------------------- > Carlos Santander > "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje > news:b60dl6$2sv1$1@digitaldaemon.com... > | uh, oops, this time i'm including it :-) > | > > Thanks! This works just fine for me. > > ------------------------- > Carlos Santander > > |
Copyright © 1999-2021 by the D Language Foundation