摘要: 本篇使用上一篇提供的接口,实现一个简单的协程调度框架.基本思想是,创建一个调度器,用于将处于活动状态的协程调度运行,调度器维护着一个actived列表,调用spawn创建协程时,将新建立的协程添加到活动列表中。调用schedule将启动调度器主循环.coro.h#ifndef _CORO_H#define _CORO_H#include <stdint.h>#include "uthread.h"struct coro{ struct coro *next; uthread_t ut; uint32_t id; start_fun st_fun; uint32_ 阅读全文
posted @ 2012-06-20 16:32 sniperHW 阅读(2284) 评论(0) 推荐(1)