Bugfix: memory and thread-deleting problems
[monky] / src / moc.c
index 652d421..7988185 100644 (file)
--- a/src/moc.c
+++ b/src/moc.c
@@ -1,4 +1,5 @@
 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
+ * vim: ts=4 sw=4 noet ai cindent syntax=c
  *
  * MOC Conky integration
  *
@@ -18,8 +19,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * vim: ts=4 sw=4 noet ai cindent syntax=c
- *
  */
 
 #include "conky.h"
@@ -99,9 +98,9 @@ static void update_infos(void)
        pclose(fp);
 }
 
-void *update_moc(void *) __attribute__((noreturn));
+static void *update_moc_loop(void *) __attribute__((noreturn));
 
-void *update_moc(void *arg)
+static void *update_moc_loop(void *arg)
 {
        (void)arg;
 
@@ -116,12 +115,12 @@ void *update_moc(void *arg)
        /* never reached */
 }
 
-int run_moc_thread(double interval)
+static int run_moc_thread(double interval)
 {
        if (moc_thread)
                return 0;
 
-       moc_thread = timed_thread_create(&update_moc, NULL, interval);
+       moc_thread = timed_thread_create(&update_moc_loop, NULL, interval);
        if (!moc_thread) {
                NORM_ERR("Failed to create MOC timed thread");
                return 1;
@@ -134,3 +133,8 @@ int run_moc_thread(double interval)
        return 0;
 }
 
+int update_moc(void)
+{
+       run_moc_thread(info.music_player_interval * 100000);
+       return 0;
+}