You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test is supposed to schedule repetitive tasks on the main thread, a custom thread executor. However, if you check the code it seems to be executing the runnable on the main thread for both the cases
executor?.scheduleAtFixedRate(Runnable {
h.post(Runnable {
Log.i(TAG, "Work") // Here you can see Looper.myLooper() == Looper.getMainLooper() returns true
currentBenchmark.workEvents.add(System.currentTimeMillis())
checkBenchmarkEnd(currentBenchmark)
})
}, WORK_REPEAT_MS, WORK_REPEAT_MS, TimeUnit.MILLISECONDS)
you can see Looper.myLooper() == Looper.getMainLooper() returns true in the runnable, Is this expected?
The text was updated successfully, but these errors were encountered:
mohit92
changed the title
The custom thread executor is posting runnable on main thread as well
The custom thread executor is posting runnable on main thread
May 6, 2022
Hello @mohit92 this is true, but in general we do not expect the main thread to be restricted but other threads not. So the aim here is to see whether the system restricts other thread more then the main thread. But you are right that it would be nicer to completely separate this from the main thread.. Many thanks for pointing this out
The test is supposed to schedule repetitive tasks on the main thread, a custom thread executor. However, if you check the code it seems to be executing the runnable on the main thread for both the cases
you can see Looper.myLooper() == Looper.getMainLooper() returns true in the runnable, Is this expected?
The text was updated successfully, but these errors were encountered: