Is synchronized(...){...} doomed to never be nothrow/@nogc?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 04:10:01 PDT 2016


On 5/11/2016 12:01 AM, Jacob Carlborg wrote:
> There's code in DWT and Tango as well that throws a SyncException exception when
> failing to acquire a lock.
>
> The code in DWT is basically copy pasted from Tango. Since druntime is derived
> from Tango I guess we can update the code in DWT and Tango to do what druntime
> does now, which is to throw an error instead.
>
> It's still a breaking change.
>
> Although I see now that there is a problem with updating the code in DWT. In
> some cases it catches SyncException with some logic based on that. In one case
> the try-catch is wrapped in a loop and will continue to try to acquire the look
> [1].

Perhaps instead of throwing an exception it can try to re-acquire at the lower 
level.

> In another case it catches SyncException and triggers an interrupt [2],
> which I see now is not implemented [3].

I suppose the code has to decide if it is a fatal error or not.


More information about the Digitalmars-d mailing list