ref[event]: rename

This commit is contained in:
godotg committed 2024-04-10 19:38:26 +08:00
1 parent 966fe14d89
commit 76c20ff026
5 files changed
+7 -7

No files matched your search

@@ -114,7 +114,7 @@ public abstract class EventBus {
for (var receiver : receivers) {
switch (receiver.bus()) {
case CurrentThread -> doReceiver(receiver, event);
case AsyncThread -> execute(event.executorHash(), () -> doReceiver(receiver, event));
case AsyncThread -> asyncExecute(event.executorHash(), () -> doReceiver(receiver, event));
// case VirtualThread -> Thread.ofVirtual().name("virtual-on" + clazz.getSimpleName()).start(() -> doReceiver(receiver, event));
}
}
@@ -132,13 +132,13 @@ public abstract class EventBus {
}
public static void asyncExecute(Runnable runnable) {
execute(RandomUtils.randomInt(), runnable);
asyncExecute(RandomUtils.randomInt(), runnable);
}
/**
* Use the event thread specified by the hashcode to execute the task
*/
public static void execute(int executorHash, Runnable runnable) {
public static void asyncExecute(int executorHash, Runnable runnable) {
executors[Math.abs(executorHash % EXECUTORS_SIZE)].execute(ThreadUtils.safeRunnable(runnable));
}