UEFibers

UEFibers acts as a container for fibers. It manages reusing UEFiber objects after they are finished. startFiber first tries to find a finished UEFiber and only otherwise allocates

Members

Static functions

runFibers
void runFibers()

Calls all running fibers that do not wait for a child to finish

startFiber
void startFiber(UEFiberFunc func)
void startFiber(UEFiberDelegate func)

start a function as a fiber

yield
yield(UEFiberDelegate func)
yield(UEFiberFunc func)

yield the current fiber until func is finished running

Examples

basic yield

t
{
	int i = 0;
	// reset
	UEFibers.fibers.length = 0;

	UEFibers.startFiber({ i++; Fiber.yield(); i++; });

	assert(i == 1);
	UEFibers.runFibers();
	assert(i == 2

fiber object reuse

t
{
	int i = 0;
	// reset
	UEFibers.fibers.length = 0;

	UEFibers.startFiber({ i++; });
	UEFibers.startFiber({ i++; });

	assert(UEFibers.fibers.length == 1);
	assert(i == 2

See Also

UEFiber

Meta