Giter VIP home page Giter VIP logo

Comments (3)

namandixit avatar namandixit commented on June 12, 2024

First, you would find the handle of the coroutine to which you want to yield to using co_active(), and then would jump ("yield") to it from another coroutine using co_switch().

For more details, look up Symmetric Coroutines vs Asymmetric Coroutines, and how one can be emulated in terms of another. Here's one paper from Lua's developers.

from libco.

lygstate avatar lygstate commented on June 12, 2024

and also, once a co_thread are finished, what's I need to do to remove it from co_switch?
I need some demo for that. This is a wonderfull library that also works on bare-metal:)
Just need a bit improvement about the API to easier to use

from libco.

Screwtapello avatar Screwtapello commented on June 12, 2024

co_switch() doesn't automatically switch to another thread, it only switches to the thread you name. If you want to stop switching to a particular thread, you just stop calling co_switch() on it.

If you never want to switch to a particular thread again, you should stop calling co_switch() on it, and probably also call co_delete() on it to deallocate the memory used for the stack.

from libco.

Related Issues (18)

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.