* Matthew Toseland <toad at amphibian.dyndns.org> [2008-04-04 19:22:27]:

> On Friday 04 April 2008 07:05, nextgens at freenetproject.org wrote:
> > Author: nextgens
> > Date: 2008-04-04 06:05:54 +0000 (Fri, 04 Apr 2008)
> > New Revision: 18975
> > 
> > Modified:
> >    trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
> > Log:
> > Simplify a few things synchronization-wise declaring a few variables 
> volatile 
> 
> I thought there were issues with volatile? Like it's not deterministic, and 
> you really should use locking in all nontrivial cases?

I suggest you read
http://www.javaperformancetuning.com/tips/volatile.shtml :)

Two things to add: 
        1) there is no significant performance cost for
reading a volatile on x86
        2) The SplitFileInserterSegment class is already a synchronization
nightmare so we'd better reduce the locking to the minimum there : we still
had some unsynchronized accesses to those booleans.

I think that making those booleans volatile is a step forward fighting
the "requests don't finish" kind of bugs which are likely to be
caused by race-conditions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080405/93ff3b71/attachment.pgp>

Reply via email to