-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
public void post(Object event) {
PostingThreadState postingState = currentPostingThreadState.get();
List<Object> eventQueue = postingState.eventQueue;
eventQueue.add(event);
if (!postingState.isPosting) {
postingState.isMainThread = isMainThread();
postingState.isPosting = true;
if (postingState.canceled) {
throw new EventBusException("Internal error. Abort state was not reset");
}
try {
while (!eventQueue.isEmpty()) {
postSingleEvent(eventQueue.remove(0), postingState);
}
} finally {
postingState.isPosting = false;
postingState.isMainThread = false;
}
}
}
- When one thread run
postmethod ,postingStatewhile always befalse, Is there any example can show the case thatpostStatebe false?eventQueuesize while never more than one, so WhyeventQueueis necessary?
Metadata
Metadata
Assignees
Labels
No labels