Update documentation.
This commit is contained in:
@@ -419,6 +419,16 @@ abstract WorkFunction<T:haxe.Constraints.Function>(WorkFunctionData<T>) from Wor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Stores the class path and function name of a function, so that it can be
|
||||
found again in the background thread.
|
||||
**/
|
||||
typedef WorkFunctionData<T:haxe.Constraints.Function> = {
|
||||
@:optional var classPath:String;
|
||||
@:optional var functionName:String;
|
||||
@:optional var func:T;
|
||||
};
|
||||
|
||||
@:forward
|
||||
@:allow(lime._internal.backend.html5.HTML5Thread)
|
||||
abstract Message(Dynamic) from Dynamic to Dynamic
|
||||
@@ -560,16 +570,6 @@ abstract Message(Dynamic) from Dynamic to Dynamic
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Stores the class path and function name of a function, so that it can be
|
||||
found again in the background thread.
|
||||
**/
|
||||
typedef WorkFunctionData<T:haxe.Constraints.Function> = {
|
||||
@:optional var classPath:String;
|
||||
@:optional var functionName:String;
|
||||
@:optional var func:T;
|
||||
};
|
||||
|
||||
#if macro
|
||||
typedef Worker = Dynamic;
|
||||
typedef URL = Dynamic;
|
||||
|
||||
@@ -157,8 +157,8 @@ class ThreadPool extends WorkOutput
|
||||
__Call this only from the main thread.__
|
||||
|
||||
@param doWork A single function capable of performing all of this pool's
|
||||
jobs. Always provide this function, even though it's marked as optional.
|
||||
@param mode Defaults to `MULTI_THREAEDED` on most targets, but
|
||||
jobs. Always provide `doWork`, even though it's marked as optional.
|
||||
@param mode Defaults to `MULTI_THREADED` on most targets, but
|
||||
`SINGLE_THREADED` in HTML5. In HTML5, `MULTI_THREADED` mode uses web
|
||||
workers, which impose additional restrictions.
|
||||
@param workLoad (Single-threaded mode only) A rough estimate of how much
|
||||
|
||||
@@ -29,12 +29,13 @@ using haxe.macro.Context;
|
||||
// abstracts, and classes used by all of Lime's threading classes.
|
||||
|
||||
/**
|
||||
Functions and variables available on background threads. `doWork` functions
|
||||
receive a `WorkOutput` instance as an argument, and can safely interact with
|
||||
any of its public variables and methods.
|
||||
Functions and variables available to the `doWork` function. For instance,
|
||||
the `sendProgress()`, `sendComplete()`, and `sendError()` functions allow
|
||||
returning output.
|
||||
|
||||
Notably, `WorkOutput` provides the `sendProgress()`, `sendComplete()`, and
|
||||
`sendError()` functions as a means to return output.
|
||||
`doWork` should exclusively use `WorkOutput` to communicate with the main
|
||||
thread. On many targets it's also possible to access static or instance
|
||||
variables, but this isn't thread safe and won't work in HTML5.
|
||||
**/
|
||||
@:allow(lime.system.BackgroundWorker)
|
||||
@:allow(lime.system.ThreadPool)
|
||||
@@ -102,7 +103,6 @@ class WorkOutput
|
||||
If using web workers, you can also pass a list of transferable objects.
|
||||
@see https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
|
||||
**/
|
||||
#if (lime_threads && html5) inline #end
|
||||
public function sendComplete(message:Dynamic = null, transferList:Array<Transferable> = null):Void
|
||||
{
|
||||
if (!__jobComplete.value)
|
||||
@@ -125,7 +125,6 @@ class WorkOutput
|
||||
If using web workers, you can also pass a list of transferable objects.
|
||||
@see https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
|
||||
**/
|
||||
#if (lime_threads && html5) inline #end
|
||||
public function sendError(message:Dynamic = null, transferList:Array<Transferable> = null):Void
|
||||
{
|
||||
if (!__jobComplete.value)
|
||||
@@ -148,7 +147,6 @@ class WorkOutput
|
||||
If using web workers, you can also pass a list of transferable objects.
|
||||
@see https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
|
||||
**/
|
||||
#if (lime_threads && html5) inline #end
|
||||
public function sendProgress(message:Dynamic = null, transferList:Array<Transferable> = null):Void
|
||||
{
|
||||
if (!__jobComplete.value)
|
||||
|
||||
Reference in New Issue
Block a user