[xiph-commits] r18663 - icecast/branches/ph3/icecast/src

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Sat Oct 13 14:39:21 PDT 2012


Author: ph3-der-loewe
Date: 2012-10-13 14:39:21 -0700 (Sat, 13 Oct 2012)
New Revision: 18663

Modified:
   icecast/branches/ph3/icecast/src/plugins.c
Log:
use scheduler API

Modified: icecast/branches/ph3/icecast/src/plugins.c
===================================================================
--- icecast/branches/ph3/icecast/src/plugins.c	2012-10-13 00:49:42 UTC (rev 18662)
+++ icecast/branches/ph3/icecast/src/plugins.c	2012-10-13 21:39:21 UTC (rev 18663)
@@ -28,6 +28,9 @@
 // all vars are protected by roarapi_*lock();
 static struct roar_plugincontainer * container = NULL;
 static int plugins_running = 0;
+static struct roar_scheduler * sched = NULL;
+static struct roar_scheduler_source source_container = {.type = ROAR_SCHEDULER_PLUGINCONTAINER};
+static struct roar_scheduler_source source_timeout = {.type = ROAR_SCHEDULER_TIMEOUT, .handle.timeout = {0, 500000000L}};
 
 // not protected by roarapi_*lock()
 static thread_type * plugin_thread;
@@ -40,6 +43,10 @@
     roarapi_lock();
     container = roar_plugincontainer_new_simple(ICECAST_HOST_STRING, PACKAGE_VERSION);
     roar_plugincontainer_set_autoappsched(container, 1);
+    sched = roar_scheduler_new(ROAR_SCHEDULER_FLAG_DEFAULT, ROAR_SCHEDULER_STRATEGY_DEFAULT);
+    source_container.handle.container = container;
+    roar_scheduler_source_add(sched, &source_container);
+    roar_scheduler_source_add(sched, &source_timeout);
     roarapi_unlock();
     plugin_thread = thread_create("Plugin Thread", plugin_runner, NULL, 0);
 #endif
@@ -63,7 +70,9 @@
     roarapi_lock();
     plugins_shutdown_plugin_thread();
     roar_plugincontainer_unref(container);
+    roar_scheduler_unref(sched);
     container = NULL;
+    sched = NULL;
     roarapi_unlock();
 #endif
 }
@@ -126,11 +135,10 @@
     plugins_running = 1;
     while (plugins_running)
     {
-        ret = roar_plugincontainer_appsched_trigger(container, ROAR_DL_APPSCHED_WAIT);
+        ret = roar_scheduler_iterate(sched);
 
-        roar_plugincontainer_appsched_trigger(container, ROAR_DL_APPSCHED_UPDATE);
         roarapi_unlock();
-	if ( ret == -1 )
+	if ( ret < 1 )
 	    thread_sleep(500000);
 	else
 	    thread_sleep(5000);



More information about the commits mailing list