-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add at-sigatomic macro (closes #12309) #12333
Conversation
@@ -91,6 +91,10 @@ sigatomic_end() = ccall(:jl_sigatomic_end, Void, ()) | |||
disable_sigint(f::Function) = try sigatomic_begin(); f(); finally sigatomic_end(); end | |||
reenable_sigint(f::Function) = try sigatomic_end(); f(); finally sigatomic_begin(); end | |||
|
|||
macro sigatomic(code) | |||
:(try sigatomic_begin(); $code; finally sigatomic_end(); end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be $(esc(code))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks.
i think this should encourage use of the lambda form, rather than adding additional syntax:
|
Any suggestions on how it should do that? I find this slightly cleaner for one line Any reason why the lambda forms aren't used in GTK.jl? (See also the discussion in #12309) |
Gtk.jl has complicated needs due to COPY_STACKS interfering with event loop integration (prior to that it was using the lambda form of disable_sigint). the syntax does look pretty sensible for ccall, although there's another experiment in making it zero-cost that I want to try first before adding this inlining can (in the future) handle the lambda transformation to make it equivalent to this, so i'm not too convinced by that argument |
Okay. There's been talk about various kinds of function inlining for a few years now. I'm sure we're a lot closer than we were in 2012, but you should be able to understand why I would make that statement. ;-) Looking forward to your zero-cost solution. |
Now that we have jb/functions, is this still needed? |
I argued above that this is cleaner for ccalls. @vtjnash said he had a zero-cost experiment he wanted to try first, and neither of us followed up. |
no, you can close this with your branch |
cc: @stevengj @JeffBezanson @vtjnash