[RFR] Cleanup and add lots of new tests

Man Cao manc at google.com
Mon Jun 10 17:27:57 UTC 2019


Looks good.

-Man


On Mon, Jun 10, 2019 at 10:02 AM Arthur Eubanks <aeubanks at google.com> wrote:

>
>
> On Wed, Jun 5, 2019 at 2:23 PM Man Cao <manc at google.com> wrote:
>
>> Thanks for converting these tests!
>>
>> For NonRacyStaticInitLoopTest.java, can we create a separate thread to
>> read from the static field? I think currently there is only one main thread
>> that initialize and read from the static field.
>>
> Does this look good?
> class NonRacyStaticInitLoopRunner {
>   private static int x;
>
>   static {
>     x = 5;
>   }
>
>   public static void main(String[] args) throws InterruptedException {
>     Thread t =
>         new Thread(
>             () -> {
>               x = 2;
>             });
>     t.start();
>     t.join();
>   }
> }
>>
>>
>> In NonRacySyncBlockExceptionLoopTest.java and
>> NonRacySyncBlockLoopTest.java, the @summary line could be more descriptive.
>>
> Done
>
>>
>> In NonRacySyncBlockLoopTest.java:
>> protected synchronized void run(int i) {
>>   synchronized (this) {
>> The run() method does not need to be synchronized, right?
>>
> Done
>
>>
>> For next code version, no need for a webrev, just inline an updated NonRacyStaticInitLoopRunner
>> class in email would work.
>>
>> -Man
>>
>


More information about the tsan-dev mailing list