static void fiber_consumer(ACL_FIBER *fiber, void *ctx) { ACL_CHANNEL *chan = (ACL_CHANNEL *) ctx; while (__nread < __max) { unsigned long n = acl_channel_recvul(chan); __nread++; if (__nread < __display) printf(">>fiber-%d, recv: %lu\r\n", acl_fiber_id(fiber), n); } }
static void fiber_wait(ACL_FIBER *, void *ctx) { ACL_CHANNEL *chan = (ACL_CHANNEL *) ctx; unsigned long n = acl_channel_recvul(chan); printf("----fiber-%d: get n: %lu---\r\n", acl_fiber_self(), n); for (int i = 0; __workers[i] != NULL; i++) { printf("kill fiber-%d\r\n", acl_fiber_id(__workers[i])); acl_fiber_kill(__workers[i]); } printf("---- fiber schedul stopping now ----\r\n"); acl_fiber_schedule_stop(); }