docs: Update Efl.Threadio and Efl.Appthread

This commit is contained in:
Xavi Artigas 2019-09-18 13:40:05 +02:00
parent 04df2327bd
commit 214ced325f
2 changed files with 25 additions and 26 deletions

View File

@ -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 {

View File

@ -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 {