Fix racing condition between threads in Memory
This commit is contained in:
parent
964288b61d
commit
7203dda7aa
@ -36,21 +36,22 @@ public class Memory {
|
|||||||
private final WriteTask writeTask = new WriteTask();
|
private final WriteTask writeTask = new WriteTask();
|
||||||
@NonNull
|
@NonNull
|
||||||
private final Runnables whenLoadedRunnables = new Runnables();
|
private final Runnables whenLoadedRunnables = new Runnables();
|
||||||
|
@NonNull
|
||||||
|
private final Handler handler;
|
||||||
@Inject
|
@Inject
|
||||||
Notifier notifier;
|
Notifier notifier;
|
||||||
@Named(AppModule.THREAD_BACKGROUND)
|
@Named(AppModule.THREAD_BACKGROUND)
|
||||||
@Inject
|
@Inject
|
||||||
Executor backgroundThread;
|
Executor backgroundThread;
|
||||||
@Inject
|
|
||||||
Handler handler;
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Generic value = EMPTY;
|
private Generic value = EMPTY;
|
||||||
private boolean loaded;
|
private boolean loaded;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Memory(@NonNull @Named(AppModule.THREAD_INIT) Executor initThread, @NonNull FileSystem fileSystem, @NonNull @Named(AppModule.DIR_FILES) File filesDir) {
|
public Memory(@NonNull @Named(AppModule.THREAD_INIT) Executor initThread, @NonNull FileSystem fileSystem, @NonNull @Named(AppModule.DIR_FILES) File filesDir, @NonNull Handler handler) {
|
||||||
this.fileSystem = fileSystem;
|
this.fileSystem = fileSystem;
|
||||||
this.filesDir = filesDir;
|
this.filesDir = filesDir;
|
||||||
|
this.handler = handler;
|
||||||
initThread.execute(new Runnable() {
|
initThread.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user