forked from enlightenment/efl
docs: Update Efl.Threadio and Efl.Appthread
This commit is contained in:
parent
04df2327bd
commit
214ced325f
|
@ -1,9 +1,11 @@
|
||||||
class @beta Efl.Appthread extends Efl.Loop
|
class @beta Efl.Appthread extends Efl.Loop
|
||||||
implements Efl.ThreadIO, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Efl.Core.Command_Line
|
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.
|
[[This class houses the application's thread and main loop.
|
||||||
@Efl.Appthread also Inherits from @Efl.Loop, @Efl.Io and @Efl.Task
|
It works similarly to @Efl.App but allows communicating with it from a different thread
|
||||||
So it works almost the same as Efl.App but misses some of the process-global controls from @Efl.App.]]
|
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 {
|
methods {
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
|
|
|
@ -1,61 +1,58 @@
|
||||||
import efl_object;
|
import efl_object;
|
||||||
|
|
||||||
function @beta EflThreadIOCall {
|
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 {
|
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 {
|
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 {
|
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
|
mixin @beta Efl.ThreadIO
|
||||||
{
|
{
|
||||||
[[This adds a simple indata and outdata void ptr to begin that you can
|
[[This mixin defines input and output pointers to allow exchanging data with another thread.
|
||||||
set on @Efl.Thread objects (set the indata) and get the outdata too to
|
It also defines a mechanism to call methods on that thread.
|
||||||
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.
|
|
||||||
]]
|
]]
|
||||||
methods {
|
methods {
|
||||||
@property indata {
|
@property indata {
|
||||||
[[Sets/gets on Efl.Thread object's indata.]]
|
[[Input data pointer for the thread.]]
|
||||||
set { }
|
set { }
|
||||||
get { }
|
get { }
|
||||||
values {
|
values {
|
||||||
data: void_ptr; [[Pointer data set to indata.]]
|
data: void_ptr; [[Data pointer.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property outdata {
|
@property outdata {
|
||||||
[[Sets/gets on Efl.Thread object's outdata.]]
|
[[Output data pointer for the thread.]]
|
||||||
set { }
|
set { }
|
||||||
get { }
|
get { }
|
||||||
values {
|
values {
|
||||||
data: void_ptr; [[Pointer data set to outdata.]]
|
data: void_ptr; [[Data pointer.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
call {
|
call {
|
||||||
[[Write a command as async.]]
|
[[Executes a method on a different thread, asynchronously.]]
|
||||||
params {
|
params {
|
||||||
func: EflThreadIOCall; [[A Function to call on the "other end" of a thread object]]
|
func: EflThreadIOCall; [[The method to execute asynchronously.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
call_sync {
|
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 {
|
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 {
|
events {
|
||||||
|
|
Loading…
Reference in New Issue