Help me please fix the bug

Mike Franklin slavo5150 at yahoo.com
Fri May 18 10:07:01 UTC 2018


On Friday, 18 May 2018 at 09:35:28 UTC, Majestio wrote:

>>
>> Also, I believe this is __lambda1:
>>
>> m_queue = () @trusted { return kqueue(); } ();
>>
>> Is `kqueue()` nothrow?  You probably need to decorate that 
>> lambda with `nothrow`.  (i.e. put a `nothrow` right after 
>> `@trusted`.
>>
>> Mike
>
> `kqueue()` is not nothrow. From log: "Error: function 
> 'core.sys.freebsd.sys.event.kqueue' is not nothrow"
>
> This decoration does not solve the problem :(

But you're calling it from a `nothrow` function through a lambda 
that is also not `nothrow`.  Decorate your lambda as `nothrow` 
and then, if you can't make `kqueue()` `nothrow`, put it in a 
try-catch and figure out what to do if it does throw.

m_queue = () @trusted nothrow
{
     try
     {
         return kqueue();
     }
     catch(Exception ex)
     {
         // what do you want to do about it?
     }
} ();

Mike


More information about the Digitalmars-d mailing list