Giter Club home page Giter Club logo

Comments (6)

GeorgeFence avatar GeorgeFence commented on September 4, 2024

Code: internal void Step()
{
try
{
ExecutionEnded = !executor.MoveNext();
if(ExecutionEnded)
{
executor.Reset();
executor.MoveNext();
}
}
catch(Exception ex)
{
SYS32.KernelPanic(ex, "Coroutine");
}
}

from cosmos-coroutines.

GeorgeFence avatar GeorgeFence commented on September 4, 2024

@ascpixi @zarlo

from cosmos-coroutines.

ascpixi avatar ascpixi commented on September 4, 2024

It looks like you're inheriting a class from Coroutine. You shouldn't really do that - what are you trying to achieve?

from cosmos-coroutines.

GeorgeFence avatar GeorgeFence commented on September 4, 2024

i'm trying to make repetative tasks

from cosmos-coroutines.

ascpixi avatar ascpixi commented on September 4, 2024

What do you mean by "repetitive tasks"? If you simply want to start multiple coroutines that run in infinite loops, please refer to the README file. Here's an example:

var coroutine = new Coroutine(MyCoroutine1());
coroutine.Start(); // will run the coroutine on the main pool; to run it in another, use CoroutinePool.AddCoroutine

// ...

IEnumerator<CoroutineControlPoint> MyCoroutine1()
{
    while(true) {
        Console.WriteLine("This prints every second.");
        yield return WaitFor.Seconds(1);
    }
}

More details are in the README file. Please be sure to yield return in order to return control back to the scheduler. You shouldn't inherit any class other than CoroutineControlPoint.

from cosmos-coroutines.

GeorgeFence avatar GeorgeFence commented on September 4, 2024

oh thanks

from cosmos-coroutines.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.