[asterisk-commits] dhubbard: branch group/taskprocessors r111496 - in /team/group/taskprocessors...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 27 16:01:50 CDT 2008


Author: dhubbard
Date: Thu Mar 27 16:01:49 2008
New Revision: 111496

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111496
Log:
remove poll frequency stuff and the ast_cond_timedwait thanks to questions from one Mr. Joshua Colp

Modified:
    team/group/taskprocessors/include/asterisk/taskprocessor.h
    team/group/taskprocessors/main/taskprocessor.c

Modified: team/group/taskprocessors/include/asterisk/taskprocessor.h
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/include/asterisk/taskprocessor.h?view=diff&rev=111496&r1=111495&r2=111496
==============================================================================
--- team/group/taskprocessors/include/asterisk/taskprocessor.h (original)
+++ team/group/taskprocessors/include/asterisk/taskprocessor.h Thu Mar 27 16:01:49 2008
@@ -45,7 +45,6 @@
 struct taskprocessor_singleton_info {
 	char _name[80];
 	unsigned long _id;
-	int _poll_freq;
 	int _is_purged;
 	ast_cond_t _poll_cond;
 	pthread_t _poll_thread;

Modified: team/group/taskprocessors/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/main/taskprocessor.c?view=diff&rev=111496&r1=111495&r2=111496
==============================================================================
--- team/group/taskprocessors/main/taskprocessor.c (original)
+++ team/group/taskprocessors/main/taskprocessor.c Thu Mar 27 16:01:49 2008
@@ -32,16 +32,11 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#define DEFAULT_POLL_FREQUENCY 1 
-
-static int _global_killflag = 0;
-AST_MUTEX_DEFINE_STATIC(_global_killflag_lock);
-
 AST_LIST_HEAD_STATIC(_taskprocessor_singletons, taskprocessor_singleton_info);
 static int _taskprocessor_singletons_list_size = 0;
 
 static void *tps_default_processor_function(void *data);
-static struct taskprocessor_singleton_info *tps_default_constructor(int poll_freq);
+static struct taskprocessor_singleton_info *tps_default_constructor(void);
 static int tps_taskprocessor_add(struct taskprocessor_singleton_info *t);
 static void tps_taskprocessor_destroy(void *tps);
 static void tps_taskproducer_destroy(void *tp);
@@ -224,10 +219,8 @@
 {
 	struct taskprocessor_singleton_info *i;
 	struct a_task *t;
-	struct timeval tv;
 	int size;
 	int killflag = 0;
-	struct timespec ts = { 0, };
 
 	i = (struct taskprocessor_singleton_info*)data;
 	if (!i) {
@@ -258,22 +251,13 @@
 			}
 			ast_mutex_unlock(&i->_taskprocessor_lock);
 			ast_task_free(t);
-			ast_mutex_lock(&_global_killflag_lock);
-			killflag = _global_killflag;
-			ast_mutex_unlock(&_global_killflag_lock);
 			if (--size) continue;
 		}
 		if (!killflag) {
-			tv = ast_tvadd(ast_tvnow(), ast_samp2tv(i->_poll_freq, 1));
-			ts.tv_sec = tv.tv_sec;
-			ts.tv_nsec = tv.tv_usec * 1000;
 			ast_mutex_lock(&i->_taskprocessor_lock);
-			ast_cond_timedwait(&i->_poll_cond, &i->_taskprocessor_lock, &ts);
+			ast_cond_wait(&i->_poll_cond, &i->_taskprocessor_lock);
 			ast_mutex_unlock(&i->_taskprocessor_lock);
 		}	
-		ast_mutex_lock(&_global_killflag_lock);
-		killflag = _global_killflag;
-		ast_mutex_unlock(&_global_killflag_lock);
 	}
 	while (ast_taskprocessor_depth(i)) {
 		/* stuff is in the queue */
@@ -305,7 +289,7 @@
  * \param poll_freq The polling frequency of the taskprocessor
  * \return taskprocessor_singleton_info structure on success, NULL on error
  */
-static struct taskprocessor_singleton_info *tps_default_constructor(int poll_freq)
+static struct taskprocessor_singleton_info *tps_default_constructor(void)
 {
 	struct taskprocessor_singleton_info *tps;
 	tps = ao2_alloc(sizeof(*tps), tps_taskprocessor_destroy);
@@ -314,10 +298,6 @@
 		return NULL;
 	}
 	tps->_id = (unsigned long)tps;
-	if (poll_freq < 1)
-		tps->_poll_freq = DEFAULT_POLL_FREQUENCY;
-	else
-		tps->_poll_freq = poll_freq;
 	ast_cond_init(&tps->_poll_cond, NULL);
 	tps->_poll_thread = AST_PTHREADT_NULL;
 	tps->_stats = ast_calloc(1, sizeof(*tps->_stats));
@@ -353,7 +333,7 @@
 		}
 	}
 	AST_LIST_UNLOCK(&_taskprocessor_singletons);
-	if ((p = tps_default_constructor(DEFAULT_POLL_FREQUENCY)) == NULL) {
+	if ((p = tps_default_constructor()) == NULL) {
 		ast_log(LOG_ERROR, "we can't create a taskprocessor_singleton because the default constructor failed.\n");
 		return NULL;
 	}




More information about the asterisk-commits mailing list