I have created a tool that detects data races, and it has detected a data race between getByteAtTime and fire (write after read). Again, no synchronization mechanisms protects the accesses.
And the detailed stack trace (line numbers do not match since there are some other changes that are not reflected in the repo):
[1;31mWARNING: ThreadSanitizer: data race (pid=2803606)
Write of size 1 at 0x7f7f796a5b39 by thread T11:
#0 avrora.sim.radio.Medium$Transmitter$Ticker.fire() Medium.java:246
#1 avrora.sim.clock.DeltaQueue$Link.fire() DeltaQueue.java:124
#2 avrora.sim.clock.DeltaQueue.advanceSlow() DeltaQueue.java:298
#3 avrora.sim.clock.DeltaQueue.advance() DeltaQueue.java:251
#4 avrora.sim.clock.MainClock.advance() MainClock.java:100
#5 avrora.sim.AtmelInterpreter.commit() AtmelInterpreter.java:1058
#6 avrora.arch.legacy.LegacyInterpreter.fastLoop() LegacyInterpreter.java:252
#7 avrora.arch.legacy.LegacyInterpreter.runLoop() LegacyInterpreter.java:109
#8 avrora.sim.AtmelInterpreter.start() AtmelInterpreter.java:379
#9 avrora.sim.Simulator.start() Simulator.java:531
#10 avrora.sim.SimulatorThread.run() SimulatorThread.java:99
Previous read of size 1 at 0x7f7f796a5b39 by thread T8:
#0 avrora.sim.radio.Medium$Transmission.getByteAtTime() Medium.java:628
#1 avrora.sim.radio.Medium$BasicArbitrator.mergeTransmissions() Medium.java:547
#2 avrora.sim.radio.Medium$Receiver$Ticker.deliverByte() Medium.java:405
#3 avrora.sim.radio.Medium$Receiver$Ticker.fireLocked() Medium.java:365
#4 avrora.sim.radio.Medium$Receiver$Ticker.fire() Medium.java:310
#5 avrora.sim.clock.DeltaQueue$Link.fire() DeltaQueue.java:124
#6 avrora.sim.clock.DeltaQueue.skipAhead() DeltaQueue.java:268
#7 avrora.sim.clock.MainClock.skipAhead() MainClock.java:118
#8 avrora.arch.legacy.LegacyInterpreter.sleepLoop() LegacyInterpreter.java:240
SUMMARY: ThreadSanitizer: data race Medium.java:246 in avrora.sim.radio.Medium$Transmitter$Ticker.fire()
I have created a tool that detects data races, and it has detected a data race between getByteAtTime and fire (write after read). Again, no synchronization mechanisms protects the accesses.
And the detailed stack trace (line numbers do not match since there are some other changes that are not reflected in the repo):