Exemplo n.º 1
0
static void _glut_idle(void)
{
	struct timeval tv;
	Event * event;

	event = video_plugin.helper->get_event(video_plugin.helper->gserver);
#ifdef DEBUG
	tv.tv_sec = 1;
	tv.tv_usec = 0;
#else
	tv.tv_sec = 0;
	tv.tv_usec = 1000000 / 25;
#endif
	event_register_timeout(event, &tv, _idle_timeout, event);
	event_loop(event);
}
Exemplo n.º 2
0
/* probe */
static int _probe(AppServerOptions options)
{
	Probe probe;
	AppServer * appserver;
	Event * event;
	struct timeval tv;

	memset(&probe, 0, sizeof(Probe));
	if(_probe_timeout(&probe) != 0)
	{
		free(probe.ifinfo);
		free(probe.volinfo);
		return 1;
	}
	if((event = event_new()) == NULL)
	{
		free(probe.ifinfo);
		free(probe.volinfo);
		return _probe_error(1);
	}
	if((appserver = appserver_new_event(&probe, options, "Probe", NULL,
					event)) == NULL)
	{
		free(probe.ifinfo);
		free(probe.volinfo);
		event_delete(event);
		return _probe_error(1);
	}
	tv.tv_sec = PROBE_REFRESH;
	tv.tv_usec = 0;
	if(event_register_timeout(event, &tv, (EventTimeoutFunc)_probe_timeout,
			&probe) != 0)
		_probe_error(0);
	else
		event_loop(event);
	appserver_delete(appserver);
	event_delete(event);
	free(probe.ifinfo);
	free(probe.volinfo);
	return 1;
}