Skip to content
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

Remove ITaskManager.toSafeHandler #2948

Open
Geod24 opened this issue Jan 31, 2022 · 0 comments
Open

Remove ITaskManager.toSafeHandler #2948

Geod24 opened this issue Jan 31, 2022 · 0 comments

Comments

@Geod24
Copy link
Collaborator

Geod24 commented Jan 31, 2022

/// Converts an unsafe timer handler to safe, `dg` will be executed in
/// `trusted` and exceptions happening inside the handler will be logged
private SafeTimerHandler toSafeHandler (UnsafeTimerHandler dg)
{
return (() @safe nothrow
{
() @trusted
{
try
dg();
catch (Exception e)
this.log.error("Timer handler caused an exception: {}", e.msg);
} ();
});
}

It claims to convert an unsafe delegate to a safe one. There's no such thing. Non-nothrow to nothrow is fine but nothing can make a @system delegate @safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Geod24 and others