DWT: synchronized toHash nothrow

Alex Rønne Petersen xtzgzorex at gmail.com
Mon Apr 30 11:27:34 PDT 2012


On 30-04-2012 20:18, Jesse Phillips wrote:
> So I've been wanting to switch to DTW from DFL, but that isn't too
> relevant. I though I could start with a update of the library for 2.059.
> This has ended up going into areas of synchronous and nothrow that I'm
> not as familiar.
>
> I have hit
>
> public hash_t toHash(){ synchronized(this){ return this.list.toHash(); } }
>
> base\src\java\util\Collections.d(275): Error: _d_monitorenter is not
> nothrow
> base\src\java\util\Collections.d(275): Error: function
> java.util.Collections.Collections.SynchronizedList.toHash 'toHash' is
> nothrow yet may throw
>
> ok, but what do I do. Does _d_monitorenter actually need to be nothrow
> so we can synchronize inside such functions?

Probably.

>
> On another note, I removed a bunch of "implMissing( __FILE__, __LINE__
> );)" functions like toHash(). I think this is reasonable but thought I
> would ask.

The workaround is:

public hash_t toHash()
{
     try
         synchronized (this)
             return this.list.toHash();
     catch
         assert(false);
}

-- 
- Alex


More information about the Digitalmars-d-learn mailing list