# \`ccall\` macros for controlling SIGINT handling

**URL:** https://discourse.julialang.org/t/ccall-macros-for-controlling-sigint-handling/19431
**Category:** Internals & Design
**Created:** [January 9, 2019, 9:20am UTC](https://discourse.julialang.org/t/ccall-macros-for-controlling-sigint-handling/19431 "2019-01-09T09:20:36Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [January 9, 2019, 12:56am UTC](https://discourse.julialang.org/t/ccall-macros-for-controlling-sigint-handling/19431/5 "2019-01-09T00:56:34Z")

</div>

Yes if you’re naming it `@ccall`, that should just be different syntax for `ccall`.

> [@Wrote a macro to make ccall look a little more like Julia. Need an opinion on the return type placement](https://discourse.julialang.org/t/wrote-a-macro-to-make-ccall-look-a-little-more-like-julia-need-an-opinion-on-the-return-type-placement/19373/5):
>
> wrap it with `disable_sigint` [https://docs.julialang.org/en/v1.2-dev/base/c/#Base.disable\_sigint](https://docs.julialang.org/en/v1.2-dev/base/c/#Base.disable_sigint) so that you don’t have to worry when calling the C functions that may not be interrupt safe.

It looks like `disable_sigint` far predates @yuyichao’s big cleanup of the interrupt delivery in [https://github.com/JuliaLang/julia/pull/16174](https://github.com/JuliaLang/julia/pull/16174). I’m not sure `disable_sigint` is even necessary anymore.

> [@Wrote a macro to make ccall look a little more like Julia. Need an opinion on the return type placement](https://discourse.julialang.org/t/wrote-a-macro-to-make-ccall-look-a-little-more-like-julia-need-an-opinion-on-the-return-type-placement/19373/13):
>
> determine if code is being run in a separate thread or task

A signal generated (for example) by Ctrl-C can be delivered even in a single threaded, single-`Task` environment — it’s a facility provided by the operating system (and a bit platform dependent, see [https://linux.die.net/man/2/signal](https://linux.die.net/man/2/signal) or [signal | Microsoft Learn](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/signal?view=vs-2017) for example).

Julia installs signal handlers for various internal things which users normally shouldn’t need to worry about, and from the look of the way `InterruptException` is now delivered you shouldn’t need to worry about these corrupting the state of code which you’ve `ccall`’d.

---

_[View the full topic](https://discourse.julialang.org/t/ccall-macros-for-controlling-sigint-handling/19431)._
