Esempio n. 1
0
void lwqq_async_timer_watch(LwqqAsyncTimerHandle timer,unsigned int timeout_ms,LwqqAsyncTimerCallback func,void* data)
{
    if(global_quit_lock) return;
    LWQQ__ASYNC_IMPL(loop_create)();
    timer->func = func;
    timer->data = data;
    LWQQ__ASYNC_IMPL(timer_start)(timer,timeout_ms);
    if(ev_thread_status!=THREAD_NOW_RUNNING) 
        start_ev_thread();
}
Esempio n. 2
0
void lwqq_async_io_watch(LwqqAsyncIoHandle io,int fd,int action,LwqqAsyncIoCallback fun,void* data)
{
    ev_io_init(io,event_cb_wrap,fd,action);
    LwqqAsyncIoWrap* wrap = s_malloc0(sizeof(*wrap));
    wrap->callback = fun;
    wrap->data = data;
    io->data = wrap;
    ev_io_start(EV_DEFAULT,io);
    if(ev_thread_status!=THREAD_NOW_RUNNING)
        start_ev_thread();
}
Esempio n. 3
0
void lwqq_async_io_watch(LwqqAsyncIoHandle io,int fd,int action,LwqqAsyncIoCallback func,void* data)
{
    if(global_quit_lock) return;
    LWQQ__ASYNC_IMPL(loop_create)();
    io->func = func;
    io->data = data;
    io->fd = fd;
    io->action = action;
    LWQQ__ASYNC_IMPL(io_start)(io,fd,action);
    if(ev_thread_status!=THREAD_NOW_RUNNING) 
        start_ev_thread();
}
Esempio n. 4
0
void lwqq_async_timer_watch(LwqqAsyncTimerHandle timer,unsigned int timeout_ms,LwqqAsyncTimerCallback fun,void* data)
{
    if(global_quit_lock) return;
    double second = (timeout_ms) / 1000.0;
    ev_timer_init(&timer->h,timer_cb_wrap,second,second);
    timer->func = fun;
    timer->data = data;
    if(!ev_default) build_global_loop();
    ev_timer_start(ev_default,&timer->h);
    if(ev_thread_status!=THREAD_NOW_RUNNING) 
        start_ev_thread();
}
Esempio n. 5
0
void lwqq_async_timer_watch(LwqqAsyncTimerHandle timer,unsigned int timeout_ms,LwqqAsyncTimerCallback fun,void* data)
{
    double second = (timeout_ms) / 1000.0;
    ev_timer_init(timer,timer_cb_wrap,second,second);
    LwqqAsyncTimerWrap* wrap = s_malloc(sizeof(*wrap));
    wrap->callback = fun;
    wrap->data = data;
    timer->data = wrap;
    ev_timer_start(EV_DEFAULT,timer);
    if(ev_thread_status!=THREAD_NOW_RUNNING)
        start_ev_thread();
}
Esempio n. 6
0
void lwqq_async_io_watch(LwqqAsyncIoHandle io,int fd,int action,LwqqAsyncIoCallback fun,void* data)
{
    if(global_quit_lock) return;
    ev_io_init(io,event_cb_wrap,fd,action);
    LwqqAsyncIoWrap* wrap = s_malloc0(sizeof(*wrap));
    wrap->callback = fun;
    wrap->data = data;
    io->data = wrap;
    if(!ev_default) build_global_loop();
    ev_io_start(ev_default,io);
    if(ev_thread_status!=THREAD_NOW_RUNNING) 
        start_ev_thread();
}