void psync_syncer_init(){ psync_sql_res *res; psync_uint_row row; res=psync_sql_query("SELECT folderid FROM syncedfolder WHERE synctype&"NTO_STR(PSYNC_DOWNLOAD_ONLY)"="NTO_STR(PSYNC_DOWNLOAD_ONLY)); pthread_mutex_lock(&sync_down_mutex); while ((row=psync_sql_fetch_rowint(res))) psync_add_folder_to_downloadlist_locked(row[0]); pthread_mutex_unlock(&sync_down_mutex); psync_sql_free_result(res); psync_run_thread("syncer", psync_syncer_thread); }
void psync_notifications_set_callback(pnotification_callback_t notification_callback, const char *thumbsize){ char *ts; pthread_mutex_lock(&ntf_mutex); ts=ntf_thumb_size; if (thumbsize) ntf_thumb_size=psync_strdup(thumbsize); else ntf_thumb_size=NULL; if (ts) psync_free_after_sec(ts, 10); ntf_callback=notification_callback; if (!ntf_thread_running && notification_callback){ ntf_thread_running=1; psync_run_thread("notifications", psync_notifications_thread); } pthread_mutex_unlock(&ntf_mutex); }
static void psync_p2p_start(){ pthread_mutex_lock(&p2pmutex); psync_run_thread("p2p", psync_p2p_thread); running=1; pthread_mutex_unlock(&p2pmutex); }