diff options
| author | 2024-08-27 01:54:46 +0000 | |
|---|---|---|
| committer | 2024-08-27 14:22:45 +0000 | |
| commit | 4688fd893fa1d1640e594110be9426c0b51460d5 (patch) | |
| tree | 556a3d1dd699cc0edb6d76f1f07991554b07ee3a /libs/androidfw/StringPool.cpp | |
| parent | ec252cbd88fd6eceb410bc8845752ce9757b6852 (diff) | |
Provide @ShellMainThread dispatcher as MainCoroutineDispatcher
Changes the CoroutineDispatcher (and thus scope) for shell.main to a
MainCoroutineDispatcher backed by a Handler. This is because
Executor#asCoroutineDispatcher assumes the #execute will post the
runnable but ShellExecutor actually runs it immediately if already on
the same thread. Using Handler#asCoroutinesDispatcher doesn't have the
same problem because the backing Handler always uses #post to run the
Runnable.
CoroutineDispatchers already have this immediate vs posted functionality
built-in (see CoroutineDispatcher#isDispatchNeeded), and
MainCoroutineDispatcher#immediate is available to callers that want to
explicitly run coroutines in an immediate (non-dispatching) way.
Bug: None
Flag: EXEMPT bugfix
Test: m
Change-Id: I516351b93d103b59f8fa8d191f300122acdf9001
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions