示例#1
0
文件: chan.c 项目: BadaDu/SwiftGo
/* Unblock a coroutine blocked in mill_choose_wait() function.
   It also cleans up the associated clause list. */
static void mill_choose_unblock(struct mill_clause *cl) {
    struct mill_slist_item *it;
    struct mill_clause *itcl;
    for(it = mill_slist_begin(&cl->cr->u_choose.clauses);
          it; it = mill_slist_next(it)) {
        itcl = mill_cont(it, struct mill_clause, chitem);
        if(!itcl->used)
            continue;
        mill_list_erase(&itcl->ep->clauses, &itcl->epitem);
    }
    mill_resume(cl->cr, cl->idx);
}
示例#2
0
int mill_timer_fire(void) {
    /* Avoid getting current time if there are no timers anyway. */
    if(mill_list_empty(&mill_timers))
        return 0;
    int64_t nw = now();
    int fired = 0;
    while(!mill_list_empty(&mill_timers)) {
        struct mill_timer *tm = mill_cont(
                                          mill_list_begin(&mill_timers), struct mill_timer, item);
        if(tm->expiry > nw)
            break;
        mill_list_erase(&mill_timers, mill_list_begin(&mill_timers));
        if(tm->callback)
            tm->callback(tm);
        fired = 1;
    }
    return fired;
}
示例#3
0
文件: debug.c 项目: 8l/libmill
void mill_unregister_chan(struct mill_debug_chan *ch) {
    mill_list_erase(&mill_all_chans, &ch->item);
}
示例#4
0
文件: debug.c 项目: 8l/libmill
void mill_unregister_cr(struct mill_debug_cr *cr) {
    mill_list_erase(&mill_all_crs, &cr->item);
}
示例#5
0
void mill_timer_rm(struct mill_timer *timer) {
    mill_list_erase(&mill_timers, &timer->item);
}
示例#6
0
文件: timer.c 项目: amitsaha/libmill
void mill_timer_rm(struct mill_timer *timer) {
    mill_assert(timer->expiry >= 0);
    mill_list_erase(&mill_timers, &timer->item);
    timer->expiry = -1;
}