You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
No, I'm looking for operating system signal handling, like SIGINT etc. Something like the python `signal` module.
ele...@gmail.com
unread,
Jan 14, 2016, 7:20:08 AM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
Can't you just ccall the OS functions?
Yichao Yu
unread,
Jan 14, 2016, 7:55:04 AM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Julia Users
On Thu, Jan 14, 2016 at 5:37 AM, John Travers <jtr...@gmail.com> wrote:
> No, I'm looking for operating system signal handling, like SIGINT etc.
> Something like the python `signal` module.
Note that the signal handler is global and julia relies on a number of
them to function correctly.
John Travers
unread,
Jan 14, 2016, 8:29:26 AM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
I know this, but this can be very important for codes running on simulation servers. Often signals are used to tell a process to save state and shut down as it is going to be moved to another system or the server needs maintenance. I have to handle SIGINT to do exactly this on our simulation systems (currently I run python and C++ codes which can do this). For this reason it would be useful to easily register julia functions as signal handlers so that we can achieve something like this.
Of course I could ccall, but I'd rather have an official way to do this.
ele...@gmail.com
unread,
Jan 14, 2016, 5:27:18 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
You are probably going to have to use ccall anyway to do things like save state. Only a limited set of system calls are available to signal handlers, see http://man7.org/linux/man-pages/man7/signal.7.html, and you can't rely on normal Julia IO to only use the allowed ones. Same for anything else that uses system calls.
Stefan Karpinski
unread,
Jan 14, 2016, 5:49:13 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Julia Users
The fact that it's hard is all the more reason to provide a mechanism that does it right.
John Travers
unread,
Jan 14, 2016, 6:09:58 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
Indeed, but the point is that the mechanism extends beyond just the signal functions. Maybe a package Signal_safe_operations.
ele...@gmail.com
unread,
Jan 14, 2016, 6:43:26 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
The Python signal handling actually waits until between Python interpretor instructions to dispatch the user python signal handler, it isn't actually running in signal handler context and so the restrictions are no longer relevant. But as it says, that can be an arbitrary delay.
Julia could do something similar with pipes and libuv maybe to allow "normal" code, but again at the cost of arbitrary delay.
Eric Forgy
unread,
Jan 14, 2016, 7:31:57 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
I wonder if you can do what you want to do using Tasks and Conditions? Your use case seems tailored for these guys.
ele...@gmail.com
unread,
Jan 14, 2016, 8:26:45 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
Would need to look to see if notify() only uses things that are allowed in a signal handler, then it could be a good way to do it.
[Note: I suspect notify() causes stack manipulations and those are not allowed in the signal handler, but I am not able to check right now]
ele...@gmail.com
unread,
Jan 14, 2016, 11:53:12 PM1/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
Update libuv already has signal handling, giving a callback in normal context. So it "just" needs some Julia interfacing.
John Travers
unread,
Jan 15, 2016, 5:39:13 AM1/15/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia-users
Thanks for all of your consideration of this. I had noted that libuv already exposes signals (and is already used in some places in base julia for this) in the github issue I mentioned.