remove old thread stuff

This commit is contained in:
PolynomialDivision 2017-11-20 19:05:07 +01:00
parent 9c80d0542e
commit bef2c699dd

View file

@ -25,10 +25,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <dlfcn.h> #include <dlfcn.h>s
//static void* (*real_malloc)(size_t)=NULL;
//static void* (*real_free)(void *p)=NULL;
void daemon_shutdown(); void daemon_shutdown();
@ -36,21 +33,11 @@ void signal_handler(int sig);
struct sigaction newSigAction; struct sigaction newSigAction;
pthread_t tid_probe;
pthread_t tid_client;
//pthread_t tid_get_client;
//pthread_t tid_update_hostapd_socks;
pthread_t tid_kick_clients;
pthread_t tid_ap;
void daemon_shutdown() { void daemon_shutdown() {
// kill threads // kill threads
printf("Cancelling Threads!\n"); printf("Cancelling Threads!\n");
// pthread_cancel(tid_probe); uloop_cancelled = true;
// pthread_cancel(tid_client);
//pthread_cancel(tid_get_client);
//pthread_cancel(tid_update_hostapd_socks);
// free ressources // free ressources
printf("Freeing mutex ressources\n"); printf("Freeing mutex ressources\n");
@ -58,25 +45,19 @@ void daemon_shutdown() {
pthread_mutex_destroy(&probe_array_mutex); pthread_mutex_destroy(&probe_array_mutex);
pthread_mutex_destroy(&client_array_mutex); pthread_mutex_destroy(&client_array_mutex);
pthread_mutex_destroy(&ap_array_mutex); pthread_mutex_destroy(&ap_array_mutex);
//printf("Free Counter: %d\n", free_counter);
} }
void signal_handler(int sig) { void signal_handler(int sig) {
printf("SOME SIGNAL RECEIVED!\n"); printf("SOME SIGNAL RECEIVED!\n");
switch (sig) { switch (sig) {
case SIGHUP: case SIGHUP:
//syslog(LOG_WARNING, "Received SIGHUP signal.");
break; break;
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
//syslog(LOG_INFO, "Daemon exiting");
//daemonShutdown();
daemon_shutdown(); daemon_shutdown();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
default: default:
//syslog(LOG_WARNING, "Unhandled signal %s", strsignal(sig));
break; break;
} }
} }
@ -171,11 +152,6 @@ int main(int argc, char **argv) {
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1); init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1);
//pthread_create(&tid_probe, NULL, &remove_probe_array_thread, (void *) &time_config.remove_probe);
//pthread_create(&tid_client, NULL, &remove_client_array_thread, (void *) &time_config.remove_client);
//pthread_create(&tid_get_client, NULL, &update_clients_thread, (void *) &time_config.update_client);
//pthread_create(&tid_update_hostapd_socks, NULL, &update_hostapd_sockets, &time_config.update_hostapd);
dawn_init_ubus(ubus_socket, opt_hostapd_dir); dawn_init_ubus(ubus_socket, opt_hostapd_dir);
return 0; return 0;