Exemplo n.º 1
0
static void threadGC(void) {
	loop = 0;
	protocol_thread_stop(webswitch);
	while(threads > 0) {
		usleep(10);
	}
	protocol_thread_free(webswitch);

	struct settings_t *tmp;
	while(settings) {
		tmp = settings;
		if(tmp->method) FREE(tmp->method);
		if(tmp->on_uri) FREE(tmp->on_uri);
		if(tmp->off_uri) FREE(tmp->off_uri);
		if(tmp->on_query) FREE(tmp->on_query);
		if(tmp->off_query) FREE(tmp->off_query);
		if(tmp->on_success) FREE(tmp->on_success);
		if(tmp->off_success) FREE(tmp->off_success);
		if(tmp->err_response) FREE(tmp->err_response);
		if(tmp->response) FREE(tmp->response);
		if(tmp->hasthread > 0) pthread_cancel(tmp->pth);
		settings = settings->next;
		FREE(tmp);
	}
	if(settings != NULL) {
		FREE(settings);
	}
}
Exemplo n.º 2
0
static void threadGC(void) {
	loop = 0;
	protocol_thread_stop(gpio_switch);
	while(threads > 0) {
		usleep(10);
	}
	protocol_thread_free(gpio_switch);
}
Exemplo n.º 3
0
static void dht22ThreadGC(void) {
	dht22_loop = 0;
	protocol_thread_stop(dht22);
	while(dht22_threads > 0) {
		usleep(10);
	}
	protocol_thread_free(dht22);
}
Exemplo n.º 4
0
static void theadGC(void) {
	loop = 0;
	protocol_thread_stop(ds18s20);
	while(threads > 0) {
		usleep(10);
	}
	protocol_thread_free(ds18s20);
}
Exemplo n.º 5
0
void ds18b20ThreadGC(void) {
	ds18b20_loop = 0;
	protocol_thread_stop(ds18b20);
	while(ds18b20_threads > 0) {
		usleep(10);
	}
	protocol_thread_free(ds18b20);
}
Exemplo n.º 6
0
void lircThreadGC(void) {
	lirc_loop = 0;
	protocol_thread_stop(lirc);
	while(lirc_threads > 0) {
		usleep(10);
	}
	protocol_thread_free(lirc);
}
Exemplo n.º 7
0
void xbmcThreadGC(void) {
	xbmc_loop = 0;
	struct xbmc_data_t *xtmp = NULL;
	
	while(xbmc_data) {
		xtmp = xbmc_data;
		if(xtmp->sockfd > -1) {
			close(xtmp->sockfd);
			xtmp->sockfd = -1;
		}
		sfree((void *)&xtmp->server);
		xbmc_data = xbmc_data->next;
		sfree((void *)&xtmp);
	}

	protocol_thread_stop(xbmc);
	while(xbmc_threads > 0) {
		usleep(10);
	}
	protocol_thread_free(xbmc);
}
Exemplo n.º 8
0
void programThreadGC(void) {
	program_loop = 0;
	protocol_thread_stop(program);
	while(program_threads > 0) {
		usleep(10);
	}
	protocol_thread_free(program);
	
	struct programs_t *tmp;
	while(programs) {
		tmp = programs;
		if(tmp->stop) sfree((void *)&tmp->stop);
		if(tmp->start) sfree((void *)&tmp->start);
		if(tmp->name) sfree((void *)&tmp->name);
		if(tmp->arguments) sfree((void *)&tmp->arguments);
		if(tmp->program) sfree((void *)&tmp->program);
		if(tmp->pth > 0) pthread_cancel(tmp->pth);
		programs = programs->next;
		sfree((void *)&tmp);
	}
	sfree((void *)&programs);
}