>
> (1) should happen before "executor.execute()" (because they are on the
> same thread),
>
It does not matter that they are executed on the same thread. I do not see
cause here to HB relation was set up.
--
You received this message because you are subscribed to the Google Groups
My guess because "If x and y are actions of the same thread and x comes
before y in program order, then hb(x, y)."
https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.4.5
On Tue, Sep 25, 2018 at 8:44 PM John Hening wrote:
> (1) should happen before "executor.execute()" (because
As Tom noted, The Executor's submission happens-before promise prevents a
reordering of (1) and (2) above.
Note that, as written, the reason you you don't have data races between (2)
and (2) is that executor is known to be a single threaded executor (and
will only run one task at a time).
Tom,
Actually you right. I get it!
Gil,
thanks for your note. You obviously right. If I use multithreaded executor
I got a lot races in a result.
So, does it mean that my both version of example are correct?
How to interpret a citation given by Cezary?: "If x and y are actions of
the
Hi,
I assume you are worried that (1) can be moved by the compiler below
"executor.execute()" or on processors with weak memory models changes from
(1) might not be fully visible to other threads when (2) is executed. I
believe it is not going to happen, as (1) should happen before