digitalmars.D - nogc required on C API callbacks?
- Brian Schott (8/8) Jul 09 2014 https://github.com/D-Programming-Language/druntime/blob/master/src/core/...
- Walter Bright (4/12) Jul 09 2014 I agree that callbacks shouldn't throw. The problem is existing code use...
- Brian Schott (5/8) Jul 09 2014 I was talking about @nogc (added in April, so before the 2.066
- Walter Bright (2/9) Jul 09 2014 Yes, you're right, I realized that after I posted it.
- Brian Schott (7/16) Jul 09 2014 After doing a bit more searching on the bug tracker I discovered
- Brian Schott (3/5) Jul 10 2014 https://github.com/D-Programming-Language/druntime/pull/879
- Jacob Carlborg (4/7) Jul 09 2014 Why shouldn't you be able to allocate GC memory from C?
- safety0ff (3/4) Jul 10 2014 This isn't a plain old C function, it's an asynchronous signal
- Jacob Carlborg (5/6) Jul 10 2014 I though the signal handler was just an example and this was a more
https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/signal.d When nogc was added to the top of that file, the type of sigfn_t changed from "void function(int) extern (C) system nothrow" to "void function(int) extern (C) system nothrow nogc". This breaks some code such as the ae library used by Digger. (The nogc annotation is now required on signal handlers). The argument for requiring nogc on C library callbacks makes sense to me, so I'd like to know if this was intentional.
Jul 09 2014
On 7/9/2014 12:54 PM, Brian Schott wrote:https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/signal.d When nogc was added to the top of that file, the type of sigfn_t changed from "void function(int) extern (C) system nothrow" to "void function(int) extern (C) system nothrow nogc". This breaks some code such as the ae library used by Digger. (The nogc annotation is now required on signal handlers). The argument for requiring nogc on C library callbacks makes sense to me, so I'd like to know if this was intentional.I agree that callbacks shouldn't throw. The problem is existing code uses callbacks that aren't annotated with 'nothrow', and we don't like breaking all their code.
Jul 09 2014
On Wednesday, 9 July 2014 at 19:59:21 UTC, Walter Bright wrote:I agree that callbacks shouldn't throw. The problem is existing code uses callbacks that aren't annotated with 'nothrow', and we don't like breaking all their code.I was talking about nogc (added in April, so before the 2.066 beta and after the 2.065 release). nothrow has been there since 2012 according to git blame, so nothrow is not what's causing the signal handling code to not compile.
Jul 09 2014
On 7/9/2014 1:08 PM, Brian Schott wrote:On Wednesday, 9 July 2014 at 19:59:21 UTC, Walter Bright wrote:Yes, you're right, I realized that after I posted it.I agree that callbacks shouldn't throw. The problem is existing code uses callbacks that aren't annotated with 'nothrow', and we don't like breaking all their code.I was talking about nogc (added in April, so before the 2.066 beta and after the 2.065 release). nothrow has been there since 2012 according to git blame, so nothrow is not what's causing the signal handling code to not compile.
Jul 09 2014
On Wednesday, 9 July 2014 at 19:54:11 UTC, Brian Schott wrote:https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/signal.d When nogc was added to the top of that file, the type of sigfn_t changed from "void function(int) extern (C) system nothrow" to "void function(int) extern (C) system nothrow nogc". This breaks some code such as the ae library used by Digger. (The nogc annotation is now required on signal handlers). The argument for requiring nogc on C library callbacks makes sense to me, so I'd like to know if this was intentional.After doing a bit more searching on the bug tracker I discovered that this is another instance of https://issues.dlang.org/show_bug.cgi?id=12710 https://issues.dlang.org/show_bug.cgi?id=12738 I'll create a pull request that rearranges a few more of these attributes.
Jul 09 2014
On Wednesday, 9 July 2014 at 22:20:16 UTC, Brian Schott wrote:I'll create a pull request that rearranges a few more of these attributes.https://github.com/D-Programming-Language/druntime/pull/879 Can I get somebody to look at this?
Jul 10 2014
On 09/07/14 21:54, Brian Schott wrote:The argument for requiring nogc on C library callbacks makes sense to me, so I'd like to know if this was intentional.Why shouldn't you be able to allocate GC memory from C? -- /Jacob Carlborg
Jul 09 2014
On Thursday, 10 July 2014 at 06:47:37 UTC, Jacob Carlborg wrote:Why shouldn't you be able to allocate GC memory from C?This isn't a plain old C function, it's an asynchronous signal handler.
Jul 10 2014
On 10/07/14 21:21, safety0ff wrote:This isn't a plain old C function, it's an asynchronous signal handler.I though the signal handler was just an example and this was a more general question. -- /Jacob Carlborg
Jul 10 2014