www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DWT: synchronized toHash nothrow

reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
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?

On another note, I removed a bunch of "implMissing( __FILE__, 
__LINE__ );)" functions like toHash(). I think this is reasonable 
but thought I would ask.
Apr 30 2012
parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> writes:
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
Apr 30 2012