Hi all,
How can I get a D program to detect something a keyboard interrupt so I shut things down in a specific way?
Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 10, 2021 Shutdown signals | ||||
---|---|---|---|---|
| ||||
Hi all, How can I get a D program to detect something a keyboard interrupt so I shut things down in a specific way? |
May 10, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim | On Monday, 10 May 2021 at 23:20:47 UTC, Tim wrote: >Hi all, How can I get a D program to detect something a keyboard interrupt so I shut things down in a specific way? import core.sys.posix.signal; then you can use the same functions as C to set signal handlers. |
May 10, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 May 2021 at 23:31:11 UTC, Adam D. Ruppe wrote: >On Monday, 10 May 2021 at 23:20:47 UTC, Tim wrote: >Hi all, How can I get a D program to detect something a keyboard interrupt so I shut things down in a specific way? import core.sys.posix.signal; then you can use the same functions as C to set signal handlers. I can't find that in the docs, nor in dpldocs. Can you help out with this? |
May 10, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim | On Monday, 10 May 2021 at 23:35:06 UTC, Tim wrote: >I can't find that in the docs, nor in dpldocs. Can you help out with this? dpldocs.info/signal it comes up as the second result. The C function you call from there (on linux anyway) is sigaction. A little copy/paste out of my terminal.d:
|
May 11, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 May 2021 at 23:55:18 UTC, Adam D. Ruppe wrote: >On Monday, 10 May 2021 at 23:35:06 UTC, Tim wrote: >[...] dpldocs.info/signal it comes up as the second result. The C function you call from there (on linux anyway) is sigaction. A little copy/paste out of my terminal.d:
I don't know why I didn't find that. I was searching for the full name, maybe too specific? Thanks anyways, this is super helpful. I wish it was documented better though :( So why use sigaction and not signal? From what I can tell signal is the C way of doing things |
May 11, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim | On Tuesday, 11 May 2021 at 06:44:57 UTC, Tim wrote: >On Monday, 10 May 2021 at 23:55:18 UTC, Adam D. Ruppe wrote: >[...] I don't know why I didn't find that. I was searching for the full name, maybe too specific? Thanks anyways, this is super helpful. I wish it was documented better though :( So why use sigaction and not signal? From what I can tell signal is the C way of doing things Use |
May 11, 2021 Re: Shutdown signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Schluter | On Tuesday, 11 May 2021 at 06:59:10 UTC, Patrick Schluter wrote: >On Tuesday, 11 May 2021 at 06:44:57 UTC, Tim wrote: >On Monday, 10 May 2021 at 23:55:18 UTC, Adam D. Ruppe wrote: >[...] I don't know why I didn't find that. I was searching for the full name, maybe too specific? Thanks anyways, this is super helpful. I wish it was documented better though :( So why use sigaction and not signal? From what I can tell signal is the C way of doing things Use Thanks a lot! |