--- mqtt/src/mqttd.c 2012/04/15 21:52:12 1.2.2.4 +++ mqtt/src/mqttd.c 2012/05/05 14:51:02 1.2.2.7 @@ -9,13 +9,13 @@ io_enableDEBUG; cfg_root_t cfg; sessions_t Sessions; +pubs_t Pubs; sched_root_task_t *root; sqlite3 *acc, *pub; -pthread_mutex_t mtx_sess, mtx_pub; FILE *logg; extern char compiled[], compiledby[], compilehost[]; static char szCfgName[MAXPATHLEN]; -intptr_t Kill; +volatile intptr_t Kill; static void @@ -68,6 +68,7 @@ main(int argc, char **argv) ait_val_t v; TAILQ_INIT(&Sessions); + TAILQ_INIT(&Pubs); strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName); while ((ch = getopt(argc, argv, "hvbc:")) != -1) @@ -93,8 +94,6 @@ main(int argc, char **argv) printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); return 1; } - pthread_mutex_init(&mtx_sess, NULL); - pthread_mutex_init(&mtx_pub, NULL); openlog("mqttd", LOG_PID | LOG_CONS, LOG_DAEMON); /* load 3 plugins */ for (i = 0; i < 3; i++) @@ -104,8 +103,6 @@ main(int argc, char **argv) mqttUnloadRTLM(i); cfgUnloadConfig(&cfg); closelog(); - pthread_mutex_destroy(&mtx_pub); - pthread_mutex_destroy(&mtx_sess); return 2; } acc = call.OpenACC(&cfg); @@ -199,7 +196,5 @@ end: /* free all resources */ mqttUnloadRTLM(i); closelog(); cfgUnloadConfig(&cfg); - pthread_mutex_destroy(&mtx_pub); - pthread_mutex_destroy(&mtx_sess); return ret; }