MailboxExecutorService docs
This commit is contained in:
parent
8a9da77006
commit
9d9af68d10
@ -36,6 +36,12 @@ private fun <E : Comparable<E>> LinkedList<E>.enqueue(value: E) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [ScheduledExecutorService] which act as a mailbox, [executeQueuedTasks] must be called from main thread.
|
||||||
|
*
|
||||||
|
* [submit], [execute], etc can be called on any thread. If any of enqueueing methods are called on the same thread
|
||||||
|
* as where [executeQueuedTasks] was called, executes provided lambda immediately and returns completed future.
|
||||||
|
*/
|
||||||
class MailboxExecutorService(thread: Thread = Thread.currentThread()) : ScheduledExecutorService {
|
class MailboxExecutorService(thread: Thread = Thread.currentThread()) : ScheduledExecutorService {
|
||||||
@Volatile
|
@Volatile
|
||||||
var thread: Thread = thread
|
var thread: Thread = thread
|
||||||
|
Loading…
Reference in New Issue
Block a user