Removal of two instances of synchronization on Boolean
Deepak Bhole
dbhole at redhat.com
Thu May 17 13:19:57 PDT 2012
* Omair Majid <omajid at redhat.com> [2012-05-17 15:56]:
> On 05/17/2012 03:38 PM, Adam Domurad wrote:
> > Hello all. Tiny patch here to remove two instances of synchronization on
> > Boolean (considered bad practice as typically only two Boolean objects
> > exist).
> >
> > While I was not entirely sure what should be done about the Boolean
> > synchronization, Deepak's opinion was that the synchronization was not
> > needed, so I submitted this small patch.
>
> I could be wrong, but seems to me that read() and write() are running in
> different threads. Without some form of synchronization, writes from one
> thread may not be visible to the other thread at all. Making
> shuttingDown a 'volatile boolean' should be sufficient.
>
Good point. Yes, please change it to volatile.
Cheers,
Deepak
More information about the distro-pkg-dev
mailing list