mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-09 11:55:52 -04:00
Ensure sequential execution of configuration writer threads (#516)
* Ensure sequential execution of configuration writer threads Signed-off-by: Chang Feng <chang_196700@hotmail.com> * Change method to add synchronized to action Signed-off-by: Chang Feng <chang_196700@hotmail.com>
This commit is contained in:
parent
0c25f31493
commit
f20c11a4e2
@ -33,7 +33,9 @@ public class InvocationDispatcher<ARG> implements Consumer<ARG> {
|
|||||||
|
|
||||||
public static <ARG> InvocationDispatcher<ARG> runOn(Consumer<Runnable> executor, Consumer<ARG> action) {
|
public static <ARG> InvocationDispatcher<ARG> runOn(Consumer<Runnable> executor, Consumer<ARG> action) {
|
||||||
return new InvocationDispatcher<>(arg -> executor.accept(() -> {
|
return new InvocationDispatcher<>(arg -> executor.accept(() -> {
|
||||||
action.accept(arg.get());
|
synchronized (action) {
|
||||||
|
action.accept(arg.get());
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user