Skip to content

Commit a74cdf0

Browse files
Document MAIN_ORDERED behavior if not Android.
1 parent 6f939ca commit a74cdf0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

EventBus/src/org/greenrobot/eventbus/ThreadMode.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
/**
1919
* Each subscriber method has a thread mode, which determines in which thread the method is to be called by EventBus.
20-
* EventBus takes care of threading independently from the posting thread.
21-
*
20+
* EventBus takes care of threading independently of the posting thread.
21+
*
2222
* @see EventBus#register(Object)
23-
* @author Markus
2423
*/
2524
public enum ThreadMode {
2625
/**
27-
* Subscriber will be called directly in the same thread, which is posting the event. This is the default. Event delivery
28-
* implies the least overhead because it avoids thread switching completely. Thus this is the recommended mode for
26+
* This is the default. Subscriber will be called directly in the same thread, which is posting the event. Event delivery
27+
* implies the least overhead because it avoids thread switching completely. Thus, this is the recommended mode for
2928
* simple tasks that are known to complete in a very short time without requiring the main thread. Event handlers
3029
* using this mode must return quickly to avoid blocking the posting thread, which may be the main thread.
3130
*/
@@ -35,29 +34,34 @@ public enum ThreadMode {
3534
* On Android, subscriber will be called in Android's main thread (UI thread). If the posting thread is
3635
* the main thread, subscriber methods will be called directly, blocking the posting thread. Otherwise the event
3736
* is queued for delivery (non-blocking). Subscribers using this mode must return quickly to avoid blocking the main thread.
37+
* <p>
3838
* If not on Android, behaves the same as {@link #POSTING}.
3939
*/
4040
MAIN,
4141

4242
/**
4343
* On Android, subscriber will be called in Android's main thread (UI thread). Different from {@link #MAIN},
4444
* the event will always be queued for delivery. This ensures that the post call is non-blocking.
45+
* <p>
46+
* If not on Android, behaves the same as {@link #POSTING}.
4547
*/
4648
MAIN_ORDERED,
4749

4850
/**
4951
* On Android, subscriber will be called in a background thread. If posting thread is not the main thread, subscriber methods
5052
* will be called directly in the posting thread. If the posting thread is the main thread, EventBus uses a single
5153
* background thread, that will deliver all its events sequentially. Subscribers using this mode should try to
52-
* return quickly to avoid blocking the background thread. If not on Android, always uses a background thread.
54+
* return quickly to avoid blocking the background thread.
55+
* <p>
56+
* If not on Android, always uses a background thread.
5357
*/
5458
BACKGROUND,
5559

5660
/**
57-
* Subscriber will be called in a separate thread. This is always independent from the posting thread and the
61+
* Subscriber will be called in a separate thread. This is always independent of the posting thread and the
5862
* main thread. Posting events never wait for subscriber methods using this mode. Subscriber methods should
5963
* use this mode if their execution might take some time, e.g. for network access. Avoid triggering a large number
60-
* of long running asynchronous subscriber methods at the same time to limit the number of concurrent threads. EventBus
64+
* of long-running asynchronous subscriber methods at the same time to limit the number of concurrent threads. EventBus
6165
* uses a thread pool to efficiently reuse threads from completed asynchronous subscriber notifications.
6266
*/
6367
ASYNC

0 commit comments

Comments
 (0)