Skip to content

It will be a simple manual C++ routine library.Some apis are provided to toggle coroutines, mainly for single-threaded applications.

License

Notifications You must be signed in to change notification settings

Prince-Hervoet/RelaxingRoutines_manual

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleNetRoutine-lib

This project is in development,please do not clone or run.And it will work like this:

    #include "simple_routine.hpp"
    #include <iostream>

    void *test(void *args)
    {
        std::cout << "one" << std::endl;
        simple_await();
        std::cout << "three" << std::endl;
        return nullptr;
    }

    int main()
    {
        RoutineHandler *rh = simple_new(test, nullptr);
        simple_resume(rh);
        std::cout << "two" << std::endl;
        simple_resume(rh);
        return 0;
    }

    // log: one
            two
            one
            three

Some characters:

  • The current implementation is dominated by shared stacks.
  • When a coroutine is started, it is first executed on the shared stack, and if there is no pending state, it is executed until the end.
  • If it is suspended, a space is needed to hold the current execution of the coroutine, just like a standalone stack.

image

About

It will be a simple manual C++ routine library.Some apis are provided to toggle coroutines, mainly for single-threaded applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published