static void * swthread(void *aux) { plugins_init2(); hts_mutex_lock(&gconf.state_mutex); gconf.state_plugins_loaded = 1; hts_cond_broadcast(&gconf.state_cond); hts_mutex_unlock(&gconf.state_mutex); upgrade_init(); usage_start(); if(!gconf.disable_upgrades) { for(int i = 0; i < 10; i++) { if(!plugins_upgrade_check()) break; TRACE(TRACE_DEBUG, "plugins", "Failed to update repo, retrying in %d seconds", i + 1); sleep(i + i); } for(int i = 0; i < 10; i++) { if(!upgrade_refresh()) break; sleep(i + 1); TRACE(TRACE_DEBUG, "upgrade", "Failed to check for app upgrade, retrying in %d seconds", i + 1); } } load_site_news(); hts_mutex_lock(&gconf.state_mutex); gconf.swrefresh = 0; while(!gconf.disable_upgrades) { int timeout = 0; while(gconf.swrefresh == 0) { timeout = hts_cond_wait_timeout(&gconf.state_cond, &gconf.state_mutex, 12 * 3600 * 1000); if(timeout) break; } gconf.swrefresh = 0; hts_mutex_unlock(&gconf.state_mutex); if(!timeout) plugins_upgrade_check(); upgrade_refresh(); load_site_news(); hts_mutex_lock(&gconf.state_mutex); } hts_mutex_unlock(&gconf.state_mutex); return NULL; }
static void * swthread(void *aux) { plugins_init2(); hts_mutex_lock(&gconf.state_mutex); gconf.state_plugins_loaded = 1; hts_cond_signal(&gconf.state_cond); hts_mutex_unlock(&gconf.state_mutex); plugins_upgrade_check(); upgrade_init(); return NULL; }