Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 81de61bf authored by Joe Onorato's avatar Joe Onorato
Browse files

Change the default of how AsyncTask enqueues.

The default is now to serialize everything onto the thread pool.  If you would
like to have finer grained control over how AsyncTasks are executed, you can
call the new executeOnExecutor method, which takes a custom Executor.  The
pool used by the default is handily now accessible as THREAD_POOL_EXECUTOR.

This change is because it is too tempting to convert single threaded Janky™
code to use AsyncTask in a way that is unsafe and ends up calling the
AsyncTasks in parallel.

Also, this adds a static execute(Runnable) method to AsyncTask that posts
onto the serialized queue, so that if you don't have any parameters or
return values, you can just use Runnable instead of AsyncTask.

Change-Id: I91bdfb00193542bfc2e101bcad56e3430421884a
parent 772f5600
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment