Remove references to BackgroundWorker.

This commit is contained in:
Joseph Cloutier
2022-03-28 15:01:17 -04:00
parent f31adb845f
commit d4588434b9
4 changed files with 13 additions and 19 deletions

View File

@@ -112,7 +112,6 @@ import lime.net.HTTPRequest;
import lime.net.HTTPRequestHeader;
import lime.net.HTTPRequestMethod;
import lime.net.URIParser;
import lime.system.BackgroundWorker;
import lime.system.CFFI;
import lime.system.CFFIPointer;
import lime.system.Clipboard;

View File

@@ -2,7 +2,6 @@ package lime.system;
import lime.app.Application;
import lime.app.Event;
import lime.system.BackgroundWorker;
import lime.system.WorkOutput;
import lime.utils.Log;
#if target.threaded
@@ -45,7 +44,6 @@ import lime._internal.backend.html5.HTML5Thread as Thread;
@:fileXml('tags="haxe,release"')
@:noDebug
#end
@:allow(lime.system.BackgroundWorker)
class ThreadPool extends WorkOutput
{
#if lime_threads

View File

@@ -37,7 +37,6 @@ using haxe.macro.Context;
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)
class WorkOutput
{
@@ -243,15 +242,13 @@ class WorkOutput
In single-threaded mode, the work function shouldn't complete the job all at
once, as the main thread would lock up. Instead, it should perform a
fraction of the job each time it's called. `BackgroundWorker` and
`ThreadPool` each provide the function with a persistent `State` argument,
which can be used to track progress. In other contexts, you may be able to
`bind` your own `State` argument.
fraction of the job each time it's called. `ThreadPool` provides the
function with a persistent `State` argument that can track progress.
Alternatively, you may be able to bind your own `State` argument.
If using multi-threaded mode in HTML5, instance methods and `bind()` are
both forbidden. Inline functions may work as long as they don't try to
access `this`, but static functions are preferred. (All of these are fine in
single-threaded mode.)
Caution: if using multi-threaded mode in HTML5, this must be a static
function and binding arguments is forbidden. Compile with
`-Dlime-warn-portability` to highlight functions that won't work.
The exact length of `doWork` can vary, but single-threaded mode will run
more smoothly if it's short enough to run several times per frame.

View File

@@ -5,7 +5,7 @@ import haxe.io.Path;
import lime._internal.backend.native.NativeCFFI;
import lime.app.Event;
import lime.graphics.Image;
import lime.system.BackgroundWorker;
import lime.system.ThreadPool;
import lime.utils.ArrayBuffer;
import lime.utils.Resource;
#if hl
@@ -101,7 +101,7 @@ class FileDialog
if (type == null) type = FileDialogType.OPEN;
#if desktop
var worker = new BackgroundWorker();
var worker = new ThreadPool();
worker.onComplete.add(function(result)
{
@@ -139,7 +139,7 @@ class FileDialog
}
});
worker.run(function(_)
worker.run(function(_, __)
{
switch (type)
{
@@ -233,7 +233,7 @@ class FileDialog
public function open(filter:String = null, defaultPath:String = null, title:String = null):Bool
{
#if desktop
var worker = new BackgroundWorker();
var worker = new ThreadPool();
worker.onComplete.add(function(path:String)
{
@@ -251,7 +251,7 @@ class FileDialog
onCancel.dispatch();
});
worker.run(function(_)
worker.run(function(_, __)
{
#if linux
if (title == null) title = "Open File";
@@ -299,7 +299,7 @@ class FileDialog
}
#if desktop
var worker = new BackgroundWorker();
var worker = new ThreadPool();
worker.onComplete.add(function(path:String)
{
@@ -317,7 +317,7 @@ class FileDialog
onCancel.dispatch();
});
worker.run(function(_)
worker.run(function(_, __)
{
#if linux
if (title == null) title = "Save File";