Module jls.util.SerialWorker
Provide the SerialWorker class.
Allows to execute function in a single thread.
Usage:
local SerialWorker = require('jls.util.SerialWorker') cal serialWorker = SerialWorker:new() rialWorker:close()
Class SerialWorker
SerialWorker:new () | Creates a new SerialWorker. |
serialWorker:call (fn[, data[, sh]]) | Calls the specified function. |
serialWorker:close () | Closes this worker. |
Class SerialWorker
The SerialWorker class.
- SerialWorker:new ()
- Creates a new SerialWorker.
- serialWorker:call (fn[, data[, sh]])
-
Calls the specified function.
Parameters:
- fn function the function to call.
- data the function argument. (optional)
- sh a stream handler for intermediate results. (optional)
Returns:
-
jls.lang.Promise
a promise that resolves once the function has been called.
- serialWorker:close ()
- Closes this worker.