Skip to content

Make synchronized statement nothrow #2302

Open
@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Denis Shelomovskii reported this on 2013-10-10T06:09:20Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=11216

CC List

  • Walter Bright
  • Martin Nowak
  • FeepingCreature
  • Vladimir Panteleev
  • Mathias LANG

Description

Currently this code fails to compile because `_d_criticalenter` and `_d_criticalexit` are not `nothrow`:
---
void f() nothrow
{ synchronized { } }
---

This is because user supplied monitor can throw as `lock`/`unlock` methods of `Object.Monitor` are not `nothrow`.

Dependent druntime functions like `rt_attachDisposeEvent` and `rt_detachDisposeEvent` are thus not `nothrow` too.


The proposal is to mark user supplied monitor `lock`/`unlock` methods also `nothrow`. In the case it will be rejected documentation note about the fact synchronized statement is not `nothrow` should be added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions