From 214ced325f6e4507d093c8413a22b09986183fa3 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Wed, 18 Sep 2019 13:40:05 +0200 Subject: [PATCH] docs: Update Efl.Threadio and Efl.Appthread --- src/lib/ecore/efl_appthread.eo | 8 ++++--- src/lib/ecore/efl_threadio.eo | 43 ++++++++++++++++------------------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/lib/ecore/efl_appthread.eo b/src/lib/ecore/efl_appthread.eo index 87f10d0183..6a3c23ac34 100644 --- a/src/lib/ecore/efl_appthread.eo +++ b/src/lib/ecore/efl_appthread.eo @@ -1,9 +1,11 @@ class @beta Efl.Appthread extends Efl.Loop implements Efl.ThreadIO, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Efl.Core.Command_Line { - [[@Efl.Appthread object created to house the thread and run the loop. - @Efl.Appthread also Inherits from @Efl.Loop, @Efl.Io and @Efl.Task - So it works almost the same as Efl.App but misses some of the process-global controls from @Efl.App.]] + [[This class houses the application's thread and main loop. + It works similarly to @Efl.App but allows communicating with it from a different thread + through the @Efl.ThreadIO, @Efl.Io.Reader and @Efl.Io.Writer interfaces. + Methods can be scheduled to be executed in this thread using @Efl.ThreadIO.call and @Efl.ThreadIO.call_sync. + ]] methods { } events { diff --git a/src/lib/ecore/efl_threadio.eo b/src/lib/ecore/efl_threadio.eo index 4da455bb43..f8d778c59a 100644 --- a/src/lib/ecore/efl_threadio.eo +++ b/src/lib/ecore/efl_threadio.eo @@ -1,61 +1,58 @@ import efl_object; function @beta EflThreadIOCall { - [[ A Function to call on the "other end" of a thread object ]] + [[A Function to be called asynchronously on a different thread.]] params { - @in event: const(event); [[Event struct with an EFL_LOOP_HANDLER_CLASS as info]] + @in event: const(event); [[Event struct with an @Efl.Loop_Handler as payload.]] } }; function @beta EflThreadIOCallSync { - [[ A Function to call on the "other end" of a thread object ]] + [[A Function to be called synchronously on another thread. + Execution will be stopped until this function returns and its return value can be recovered. + ]] params { - @in event: const(event); [[Event struct with an EFL_LOOP_HANDLER_CLASS as info]] + @in event: const(event); [[Event struct with an @Efl.Loop_Handler as payload.]] } - return: void_ptr; [[The "other end" of a thread object's data]] + return: void_ptr; [[Data that the function executed on the other thread returned.]] }; mixin @beta Efl.ThreadIO { - [[This adds a simple indata and outdata void ptr to begin that you can - set on @Efl.Thread objects (set the indata) and get the outdata too to - get results. then on the efl.appthread side the indata is set on the - @Efl.Appthread before it runs and on quit the thread can set the - outdata on the appthread, and this appears back on the @Efl.Thread - object in the parent thread. - - So you can basically share pointers to anything in and out this way on - start/exit in addition to string args etc. + [[This mixin defines input and output pointers to allow exchanging data with another thread. + It also defines a mechanism to call methods on that thread. ]] methods { @property indata { - [[Sets/gets on Efl.Thread object's indata.]] + [[Input data pointer for the thread.]] set { } get { } values { - data: void_ptr; [[Pointer data set to indata.]] + data: void_ptr; [[Data pointer.]] } } @property outdata { - [[Sets/gets on Efl.Thread object's outdata.]] + [[Output data pointer for the thread.]] set { } get { } values { - data: void_ptr; [[Pointer data set to outdata.]] + data: void_ptr; [[Data pointer.]] } } call { - [[Write a command as async.]] + [[Executes a method on a different thread, asynchronously.]] params { - func: EflThreadIOCall; [[A Function to call on the "other end" of a thread object]] + func: EflThreadIOCall; [[The method to execute asynchronously.]] } } call_sync { - [[Write a command as sync.]] + [[Executes a method on a different thread, synchronously. + This call will not return until the method finishes and its return value can be recovered. + ]] params { - func: EflThreadIOCallSync; [[A Function to call on the "other end" of a thread object]] + func: EflThreadIOCallSync; [[The method to execute synchronously.]] } - return: void_ptr; [[The "other end" of a thread object's data]] + return: void_ptr; [[The return value from the method.]] } } events {