Merge: Intro `Task` and use in for Android's `run_on_ui_thread`
authorJean Privat <jean@pryen.org>
Thu, 5 Nov 2015 15:13:53 +0000 (10:13 -0500)
committerJean Privat <jean@pryen.org>
Thu, 5 Nov 2015 15:13:53 +0000 (10:13 -0500)
The `Task` interface defines a fragment of Nit code to execute in its `main` method. This interface should be compatible between different platforms and parallelization engines.

`NativeActivity::run_on_ui_thread` is widely used on Android as most logic is executed on background threads but only the UI thread can modify the UI. It is a perfect example of how the `Task` interface can be used.

Future work include using `Task` in `pthreads` and `gtk::gdk`. But there a a few differences in the logic that makes it not as easy: `Thread::main` returns a `nullable object`, but is it worth keeping it? `GdkRunnable::run` returns a boolean to tell GDK if it should be called again.

Pull-Request: #1812
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>


Trivial merge