Skip to content

coost v3.0.1 released

Compare
Choose a tag to compare
@idealvin idealvin released this 09 Sep 02:12
· 37 commits to master since this release

New features

  • Benchmark framework.
#include "co/benchmark.h"
#include "co/mem.h"

BM_group(malloc) {
     void* p;

     BM_add(::malloc)(
         p = ::malloc(32);
     );
     BM_use(p);

     BM_add(co::alloc)(
         p = co::alloc(32);
     );
     BM_use(p);
}

int main(int argc, char** argv) {
     flag::parse(argc, argv);
     bm::run_benchmarks();
     return 0;
}

bm.png

  • gen supports generating code for converting JSON to struct, refer to the example test/j2s.

Improvement

  • Coroutine scheduling optimization.
  • Improve coroutine-related components. co::mutex, co::event, co::chan, etc. can be used in coroutines or non-coroutines, and POD types like std::string can be stored in co::chan.

Others

  • Removed Random class, provided co::rand(), co::randstr(), and renamed the header file to co/rand.h`.
  • Remove the global Thread and Mutex.
  • APIs such as co::*scheduler* are renamed to co::*sched*.
  • Other improvements, bug fixes, etc.