void vp_do_repeat(vp_command cmd,void* retval) { if(cmd.dsph && cmd.func){ vp_start(cmd.data); cmd.dsph(cmd.func,&cmd.data,retval); } vp_command* n = cmd.next; while(n){ vp_start(n->data); n->dsph(n->func,&n->data,NULL); n = n->next; } }
void vp_cancel(vp_command cmd) { vp_start(cmd.data); vp_end(cmd.data); cmd.dsph = (VP_DISPATCH)NULL; cmd.func = (VP_CALLBACK)NULL; vp_command* n = cmd.next; cmd.next = NULL; vp_command* p; while(n){ vp_start(n->data); vp_end(n->data); p = n; n = n->next; free(p); } }
void vp_do(vp_command cmd,void* retval) { if(cmd.dsph==NULL||cmd.func==NULL) return; vp_start(cmd.data); cmd.dsph(cmd.func,&cmd.data,retval); vp_end(cmd.data); cmd.dsph = (VP_DISPATCH)NULL; cmd.func = (VP_CALLBACK)NULL; vp_command* n = cmd.next; cmd.next = NULL; vp_command* p; while(n){ vp_start(n->data); n->dsph(n->func,&n->data,NULL); vp_end(n->data); p = n; n = n->next; free(p); } }
static void timeout_come(LwqqAsyncTimerHandle timer,void* p) { async_dispatch_data* data = (async_dispatch_data*)p; DISPATCH_FUNC dsph = data->dsph; CALLBACK_FUNC func = data->func; vp_start(data->data); dsph(func,&data->data,NULL); vp_end(data->data); lwqq_async_timer_stop(timer); //!!! should we stop first delete later? s_free(data); }