Comment

Comment by halayli

I think lthread (http://github.com/halayli/lthread) is the only coroutine lib that allows you to block inside a coroutine and do heavy computation without affecting other coroutines.

Example:

  void my_function(void* arg)
  {
      char buf[1024];

      int ret = lthread_recv_exact(fd, buf, 1024, 0, timeout);

      lthread_compute_begin();
      /* block as long as you wish, run heavy computation on buf, access your stack variables etc.. */

      lthread_compute_end();
  }
Disclaimer: lthread author.
parent halayli 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton