Ejemplo n.º 1
0
/*
 * 功能:ev_periodic的回调函数
 * 疑问:为何系统时间的更改会有一定的滞后性?
 */
void
periodic_callback(struct ev_loop *loop, ev_periodic *w, int revents)
{
    time_t      now;

    printf("ev_iteration=%d\n", ev_iteration(loop));
    printf("ev_pending_count=%d\n", ev_pending_count(loop));
    printf("offset:%f,interval:%f\n", w->offset, w->interval);
    
    time(&now);
    printf("now timestamp:%lu\n", now);
}
Ejemplo n.º 2
0
/**
 * Returns the number of pending events.
 * 
 * @return int
 * @return boolean  false if object has not been initialized
 */
PHP_METHOD(EventLoop, getPendingCount)
{
	event_loop_object *obj = (event_loop_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
	
	assert(obj->loop);
	
	if(obj->loop)
	{
		RETURN_LONG(ev_pending_count(obj->loop));
	}
	
	RETURN_BOOL(0);
}
Ejemplo n.º 3
0
static void
_check_cb(UNUSED EV_P_ UNUSED ev_check *w, UNUSED int revents)
{
    int npending;

    npending = ev_pending_count(the_loop);
#ifdef TRACE_VERBOSE
    CTRACE("ev_pending_count=%d", npending);
#endif
    if (npending <= 0) {
        //CTRACE("Breaking loop? ...");
        //ev_break(the_loop, EVBREAK_ALL);
    }
    timecounter_now = (uint64_t)(ev_now(the_loop) * 1000000000.);

    //CTRACE("revents=%08x", revents);
}
Ejemplo n.º 4
0
static int lwqq_gdb_still_waiting()
{
    return ev_pending_count(ev_default);
}
Ejemplo n.º 5
0
static PyObject *
Loop_pending_get(Loop *self, void *closure)
{
    return PyInt_FromUnsignedLong(ev_pending_count(self->loop));
}