int sc_ctl_call(sc *s, uint64_t vlsn) { int rc = sr_statusactive(s->r->status); if (ssunlikely(rc == 0)) return 0; scworker *w = sc_workerpool_pop(&s->wp, s->r); if (ssunlikely(w == NULL)) return -1; rc = sc_step(s, w, vlsn); sc_workerpool_push(&s->wp, w); return rc; }
static void* se_worker(void *arg) { ssthread *self = arg; se *e = self->arg; ss_thread_setname(self, "worker"); ss_vfsioprio_low(&e->vfs); scworker *w = sc_workerpool_pop(&e->scheduler.wp, &e->r); if (ssunlikely(w == NULL)) return NULL; for (;;) { int rc = se_active(e); if (ssunlikely(rc == 0)) break; rc = sc_step(&e->scheduler, w, sx_vlsn(&e->xm)); if (ssunlikely(rc == -1)) break; if (ssunlikely(rc == 0)) ss_sleep(10000000); /* 10ms */ } sc_workerpool_push(&e->scheduler.wp, w); return NULL; }