Skip to content

Fiber Management

Mike Puskar edited this page Dec 29, 2021 · 6 revisions

IPT.Common contains an abstract GenericFiber class that can be inherited to provide a simple interface to a long-running fiber. The fiber can be started and stopped, and the periodicity of the fiber is set upon instantiation.

Example Fiber

using IPT.Common.API;
using IPT.Common.Fibers;

namespace IPT.TestPlugin.Fibers
{
    internal class TestFiber : GenericFiber
    {
        public TestFiber()
            : base("testfiber", 1000)
        {

        }

        protected override void DoSomething() // this will happen every second
        {
            Logging.Debug("still here");
            Logging.Info("still here");
        }
    }
}

Usage

var fiber = TestFiber();
fiber.Start();
fiber.Stop();
Clone this wiki locally