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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 29 15:38:37 CDT 2008


Author: dhubbard
Date: Sat Mar 29 15:38:36 2008
New Revision: 111954

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111954
Log:
rename a_task to ast_task; rename taskprocessor_singleton_info to ast_taskprocessor; rename taskprocessor_singleton_stats to ast_taskprocessor_stats

Modified:
    team/group/taskprocessors/apps/app_queue.c
    team/group/taskprocessors/apps/app_voicemail.c
    team/group/taskprocessors/channels/chan_sip.c
    team/group/taskprocessors/include/asterisk/taskprocessor.h
    team/group/taskprocessors/main/pbx.c
    team/group/taskprocessors/main/taskprocessor.c

Modified: team/group/taskprocessors/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_queue.c?view=diff&rev=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/apps/app_queue.c (original)
+++ team/group/taskprocessors/apps/app_queue.c Sat Mar 29 15:38:36 2008
@@ -132,7 +132,7 @@
 	{ QUEUE_STRATEGY_WRANDOM, "wrandom"},
 };
 
-static struct taskprocessor_singleton_info *taskprocessor;
+static struct ast_taskprocessor *taskprocessor;
 
 #define DEFAULT_RETRY		5
 #define DEFAULT_TIMEOUT		15
@@ -732,7 +732,7 @@
 }
 
 /*! \brief set a member's status based on device state of that member's interface*/
-static int handle_statechange(struct a_task *task)
+static int handle_statechange(struct ast_task *task)
 {
 	struct member_interface *curint;
 	char *loc;
@@ -783,7 +783,7 @@
 	enum ast_device_state state;
 	const char *device;
 	struct statechange *sc;
-	struct a_task* t;
+	struct ast_task* t;
 	size_t datapsize;
 
 	state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);

Modified: team/group/taskprocessors/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/apps/app_voicemail.c?view=diff&rev=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/apps/app_voicemail.c (original)
+++ team/group/taskprocessors/apps/app_voicemail.c Sat Mar 29 15:38:36 2008
@@ -623,7 +623,7 @@
 	uint32_t uniqueid;
 };
 
-static struct taskprocessor_singleton_info *taskprocessor;
+static struct ast_taskprocessor *taskprocessor;
 
 static AST_RWLIST_HEAD_STATIC(mwi_subs, mwi_sub);
 
@@ -8106,7 +8106,7 @@
 	ast_free(mwi_sub);
 }
 
-static int handle_unsubscribe(struct a_task *task)
+static int handle_unsubscribe(struct ast_task *task)
 {
 	struct mwi_sub *mwi_sub;
 	uint32_t *uniqueid = (uint32_t *)task->_datap;
@@ -8129,7 +8129,7 @@
 	return 0;
 }
 
-static int handle_subscribe(struct a_task *task)
+static int handle_subscribe(struct ast_task *task)
 {
 	unsigned int len;
 	struct mwi_sub *mwi_sub;
@@ -8164,7 +8164,7 @@
 
 static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
 {
-	struct a_task *t;
+	struct ast_task *t;
 	uint32_t u, *uniqueid = ast_calloc(1, sizeof(*uniqueid));
 	if (ast_event_get_type(event) != AST_EVENT_UNSUB)
 		return;
@@ -8187,7 +8187,7 @@
 static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
 {
 	struct mwi_sub_task *mwist;
-	struct a_task *t;
+	struct ast_task *t;
 	if (ast_event_get_type(event) != AST_EVENT_SUB)
 		return;
 

Modified: team/group/taskprocessors/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/channels/chan_sip.c?view=diff&rev=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/channels/chan_sip.c (original)
+++ team/group/taskprocessors/channels/chan_sip.c Sat Mar 29 15:38:36 2008
@@ -1305,7 +1305,7 @@
 	struct sip_st_dlg *stimer;		/*!< SIP Session-Timers */              
 };
 
-static struct taskprocessor_singleton_info *taskprocessor;
+static struct ast_taskprocessor *taskprocessor;
 struct sip_handle_request_task {
 	struct sip_request req;
 	struct sockaddr_in sin;
@@ -1704,7 +1704,7 @@
 static int sip_queryoption(struct ast_channel *chan, int option, void *data, int *datalen);
 static const char *sip_get_callid(struct ast_channel *chan);
 
-static int handle_request_do(struct a_task *task);
+static int handle_request_do(struct ast_task *task);
 static int sip_standard_port(struct sip_socket s);
 static int sip_prepare_socket(struct sip_pvt *p);
 
@@ -18085,7 +18085,7 @@
 static int sipsock_read(int *id, int fd, short events, void *ignore)
 {
 	struct sip_handle_request_task *taskdata;
-	struct a_task *task;
+	struct ast_task *task;
 	int res;
 	socklen_t len;
 	static char readbuf[65535];
@@ -18129,7 +18129,7 @@
 	return 1;
 }
 
-static int handle_request_do(struct a_task *task) 
+static int handle_request_do(struct ast_task *task) 
 {
 	struct sip_pvt *p;
 	int recount = 0;

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=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/include/asterisk/taskprocessor.h (original)
+++ team/group/taskprocessors/include/asterisk/taskprocessor.h Sat Mar 29 15:38:36 2008
@@ -32,46 +32,46 @@
  *
  * \note A taskprocessor is a singleton processing thread that can be referenced
  * with a friendly name and shared across modules.  Modules that reference a taskprocessor
- * can push a_task objects into the default taskprocessor FIFO container.  The default
+ * can push ast_task objects into the default taskprocessor FIFO container.  The default
  * taskprocessing function can be overridden at the time of taskprocessor creation using
  * the ast_taskprocessor_reference() function.  Taskprocessors utilize astobj2 and will
  * be created upon the first reference to a taskprocessor name, as well as destroy
  * themselves when the taskprocessor reference count reaches zero.
  *
- * The a_task structure has a callback function, called execute(), that is called by the
+ * The ast_task structure has a callback function, called execute(), that is called by the
  * taskprocessor when the task is popped off the queue.  The execute() callback handler
  * is responsible for processing the task data and freeing task data resources, if necessary
  * and then setting the task datap pointer to NULL before returning.  The taskprocessor will 
  * free the task structure after the task callback returns control to the taskprocessor function.
  */
 
-/*! \brief a_task structure is queued to a taskprocessor and released
+/*! \brief ast_task structure is queued to a taskprocessor and released
  * by the taskprocessing thread.  The callback function that is assigned
  * to the execute() function pointer is responsible for releasing
  * _datap resources if necessary. */
-struct a_task {
+struct ast_task {
 	/*! \brief The execute() task callback function pointer */
-	int (*execute)(struct a_task *t);
+	int (*execute)(struct ast_task *t);
 	/*! \brief The data pointer for the task execute() function */
 	void *_datap;
 	/*! \brief The function that allocated a task object (To become debug only) */
 	char _source[256];
 	/*! \brief AST_LIST_ENTRY overhead */
-	AST_LIST_ENTRY(a_task) list;
+	AST_LIST_ENTRY(ast_task) list;
 };
 
-/*! \brief taskprocessor_singleton_stats are technically optional, but
+/*! \brief ast_taskprocessor_stats are technically optional, but
  * used by default to keep track of statistics for an individual taskprocessor */
-struct taskprocessor_singleton_stats {
+struct ast_taskprocessor_stats {
 	/*! \brief This is the maximum number of tasks queued at any one time */
 	unsigned long _max_qsize;
 	/*! \brief This is the current number of tasks processed */
 	unsigned long _tasks_processed_count;
 };
 
-/*! \brief A taskprocessor_singleton_info structure is used to manage 
+/*! \brief A ast_taskprocessor structure is used to manage 
  *  a unique taskprocessor thread */
-struct taskprocessor_singleton_info {
+struct ast_taskprocessor {
 	/*! \brief Friendly name of the taskprocessor */
 	char _name[80];
 	/*! \brief Address of the taskprocessor singleton structure */
@@ -87,32 +87,32 @@
 	/*! \brief Hold a pointer to the taskprocessing function */
 	void *(*_poll_function)(void*);
 	/*! \brief Taskprocessor statistics */
-	struct taskprocessor_singleton_stats *_stats;
+	struct ast_taskprocessor_stats *_stats;
 	/*! \brief private data for a taskprocessor */
 	void *_private;
 	/*! \brief Taskprocessor current queue size */
 	long _queue_size;
 	/*! \brief Taskprocessor queue */
-	AST_LIST_HEAD(_queue, a_task) _queue;
+	AST_LIST_HEAD(_queue, ast_task) _queue;
 	/*! \brief Taskprocessor singleton list entry */
-	AST_LIST_ENTRY(taskprocessor_singleton_info) list;
+	AST_LIST_ENTRY(ast_taskprocessor) list;
 };
 
 /*! \brief Initialize the taskprocessor subsystem */
 int ast_tps_init(void);
 
-/*! \brief Allocate a_task object */
-struct a_task *ast_task_alloc(int (*task_exe)(struct a_task *task), void *datap, char *src);
-/*! \brief Release a_task resources */
-int ast_task_free(struct a_task *task);
+/*! \brief Allocate ast_task object */
+struct ast_task *ast_task_alloc(int (*task_exe)(struct ast_task *task), void *datap, char *src);
+/*! \brief Release ast_task resources */
+int ast_task_free(struct ast_task *task);
 
 /*! \brief Obtain a taskprocessor reference */
-struct taskprocessor_singleton_info *ast_taskprocessor_reference(const char *name, void *(*func)(void*));
+struct ast_taskprocessor *ast_taskprocessor_reference(const char *name, void *(*func)(void*));
 /*! \brief Push a task on the taskprocessor */
-int ast_taskprocessor_push(struct taskprocessor_singleton_info *tp, struct a_task *t);
+int ast_taskprocessor_push(struct ast_taskprocessor *tp, struct ast_task *t);
 /*! \brief Pop the front task off the taskprocessor queue and return it to the calling function */
-struct a_task *ast_taskprocessor_pop(struct taskprocessor_singleton_info *tp);
-/*! \brief Return the number of a_task elements currently in the taskprocessor queue */
-int ast_taskprocessor_depth(struct taskprocessor_singleton_info *tp);
+struct ast_task *ast_taskprocessor_pop(struct ast_taskprocessor *tp);
+/*! \brief Return the number of ast_task elements currently in the taskprocessor queue */
+int ast_taskprocessor_depth(struct ast_taskprocessor *tp);
 #endif
 

Modified: team/group/taskprocessors/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/main/pbx.c?view=diff&rev=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/main/pbx.c (original)
+++ team/group/taskprocessors/main/pbx.c Sat Mar 29 15:38:36 2008
@@ -125,7 +125,7 @@
 struct ast_context;
 struct ast_app;
 
-static struct taskprocessor_singleton_info *taskprocessor;
+static struct ast_taskprocessor *taskprocessor;
 
 AST_THREADSTORAGE(switch_data);
 
@@ -2933,7 +2933,7 @@
 	return ast_extension_state2(e);    		/* Check all devices in the hint */
 }
 
-static int handle_statechange(struct a_task *task)
+static int handle_statechange(struct ast_task *task)
 {
 	struct ast_hint *hint;
 	struct statechange *sc = task->_datap;
@@ -7801,7 +7801,7 @@
 {
 	const char *device;
 	struct statechange *sc;
-	struct a_task *t;
+	struct ast_task *t;
 
 	device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
 	if (ast_strlen_zero(device)) {

Modified: team/group/taskprocessors/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/main/taskprocessor.c?view=diff&rev=111954&r1=111953&r2=111954
==============================================================================
--- team/group/taskprocessors/main/taskprocessor.c (original)
+++ team/group/taskprocessors/main/taskprocessor.c Sat Mar 29 15:38:36 2008
@@ -33,17 +33,17 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-AST_LIST_HEAD_STATIC(_taskprocessor_singletons, taskprocessor_singleton_info);
+AST_LIST_HEAD_STATIC(_taskprocessor_singletons, ast_taskprocessor);
 static int _taskprocessor_singletons_list_size = 0;
 static ast_cond_t _cli_ping_cond;
 static ast_mutex_t _cli_ping_cond_lock;
 
 static void *tps_default_processor_function(void *data);
-static struct taskprocessor_singleton_info *tps_default_constructor(void);
-static int tps_taskprocessor_add(struct taskprocessor_singleton_info *t);
+static struct ast_taskprocessor *tps_default_constructor(void);
+static int tps_taskprocessor_add(struct ast_taskprocessor *t);
 static int tps_taskprocessor_count(void);
 static void tps_taskprocessor_destroy(void *tps);
-static int tps_taskprocessor_ping_handler(struct a_task* e);
+static int tps_taskprocessor_ping_handler(struct ast_task* e);
 
 static char *cli_taskprocessor_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *cli_taskprocessor_show_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
@@ -69,9 +69,9 @@
  * \param src where the task came from, this is going to be debug only
  * \return A task prepared to be queued into a taskprocessor
  */
-struct a_task *ast_task_alloc(int (*task_exe)(struct a_task *task), void *datap, char *src)
-{
-	struct a_task *t;
+struct ast_task *ast_task_alloc(int (*task_exe)(struct ast_task *task), void *datap, char *src)
+{
+	struct ast_task *t;
 	t = ast_calloc(1,sizeof(*t));
 	if (!t) {
 		ast_log(LOG_ERROR, "Failed to allocate memory for \'%s\'\n", src);
@@ -87,7 +87,7 @@
  * \param task the task to be freed
  * \return 0 on success
  */
-int ast_task_free(struct a_task *task)
+int ast_task_free(struct ast_task *task)
 {
 	if (task->_datap) {
 		ast_free(task->_datap);
@@ -96,11 +96,11 @@
 }
 
 /*! \brief Tab completion function
- * \param p taskprocessor_singleton_info structure
+ * \param p ast_taskprocessor structure
  * \param a CLI arguments
  * \return NULL
  */
-static char *tps_taskprocessor_tab_complete(struct taskprocessor_singleton_info *p, struct ast_cli_args *a) 
+static char *tps_taskprocessor_tab_complete(struct ast_taskprocessor *p, struct ast_cli_args *a) 
 {
 	int tklen;
 	int wordnum = 0;
@@ -124,7 +124,7 @@
  * \param task the ping task queued by the CLI operation
  * \return 0 on success, -1 on error
  */
-static int tps_taskprocessor_ping_handler(struct a_task *task)
+static int tps_taskprocessor_ping_handler(struct ast_task *task)
 {
 	if (!task) {
 		ast_log(LOG_ERROR, "Huh?  There is no task?  This is terribly vexing!\n");
@@ -147,8 +147,8 @@
 	struct timeval begin, end, delta;
 	char *name;
 	int found = 0;
-	struct a_task *t = NULL;
-	struct taskprocessor_singleton_info *tps = NULL;
+	struct ast_task *t = NULL;
+	struct ast_taskprocessor *tps = NULL;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -208,7 +208,7 @@
 	unsigned long qsize;
 	unsigned long maxqsize;
 	unsigned long processed;
-	struct taskprocessor_singleton_info *p;
+	struct ast_taskprocessor *p;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -241,19 +241,19 @@
 }
 
 /*! \brief The default taskprocessing thread pops tasks off its queue and executes it
- * \param data taskprocessor_singleton_info structure for the named thread
+ * \param data ast_taskprocessor structure for the named thread
  * \note The default taskprocessor thread function can be overridden via ast_taskprocessor_reference()
  * \return NULL
  */
 static void *tps_default_processor_function(void *data)
 {
-	struct taskprocessor_singleton_info *i;
-	struct a_task *t;
+	struct ast_taskprocessor *i;
+	struct ast_task *t;
 	int size;
 
-	i = (struct taskprocessor_singleton_info*)data;
+	i = (struct ast_taskprocessor*)data;
 	if (!i) {
-		ast_log(LOG_ERROR, "cannot start thread_function loop without a taskprocessor_singleton_info structure.\n");
+		ast_log(LOG_ERROR, "cannot start thread_function loop without a ast_taskprocessor structure.\n");
 		return NULL;
 	}
 
@@ -303,14 +303,14 @@
 
 /*! \brief The default taskprocessor constructor creates an initialized taskprocessor structure
  * \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(void)
-{
-	struct taskprocessor_singleton_info *tps;
+ * \return ast_taskprocessor structure on success, NULL on error
+ */
+static struct ast_taskprocessor *tps_default_constructor(void)
+{
+	struct ast_taskprocessor *tps;
 	tps = ao2_alloc(sizeof(*tps), tps_taskprocessor_destroy);
 	if (!tps) {
-		ast_log(LOG_ERROR, "cannot allocate memory for a taskprocessor_singleton_info structure.\n");
+		ast_log(LOG_ERROR, "cannot allocate memory for a ast_taskprocessor structure.\n");
 		return NULL;
 	}
 	tps->_id = (unsigned long)tps;
@@ -318,7 +318,7 @@
 	tps->_poll_thread = AST_PTHREADT_NULL;
 	tps->_stats = ast_calloc(1, sizeof(*tps->_stats));
 	if (!tps->_stats) {
-		ast_log(LOG_ERROR, "cannot allocate memory for a taskprocessor_singleton_stats structure.\n");
+		ast_log(LOG_ERROR, "cannot allocate memory for a ast_taskprocessor_stats structure.\n");
 		ao2_ref(tps, -1);
 		return NULL;
 	}
@@ -328,12 +328,12 @@
 /*! \brief Return a pointer to the taskprocessor singleton structure and create it if necessary.
  * \param name the name of the taskprocessor singleton
  * \param custom_func the function executed by the taskprocessor thread
- * \return taskprocessor_singleton_info pointer on success, NULL on error
- */
-struct taskprocessor_singleton_info *ast_taskprocessor_reference(const char *name, void *(*custom_func)(void*))
+ * \return ast_taskprocessor pointer on success, NULL on error
+ */
+struct ast_taskprocessor *ast_taskprocessor_reference(const char *name, void *(*custom_func)(void*))
 {
 	int rc;
-	struct taskprocessor_singleton_info *p;
+	struct ast_taskprocessor *p;
 		
 	if (!name) {
 		ast_log(LOG_ERROR, "requesting a nameless taskprocessor!!!\n");
@@ -397,13 +397,13 @@
 }
 	
 /*! \brief The taskprocessor destructor is called by astobj2 when the reference count reaches zero
- * \param tps taskprocessor_singleton_info structure
+ * \param tps ast_taskprocessor structure
  * \return void
  */
 static void tps_taskprocessor_destroy(void *tps)
 {
-	struct taskprocessor_singleton_info *n;
-	struct taskprocessor_singleton_info *t = (struct taskprocessor_singleton_info *)tps;
+	struct ast_taskprocessor *n;
+	struct ast_taskprocessor *t = (struct ast_taskprocessor *)tps;
 
 	ast_debug(5, "destroying taskprocessor \'%s\'\n", t->_name);
 	if (!t) {
@@ -433,13 +433,13 @@
 	return;
 }
 
-/*! \brief Add a new taskprocessor_singleton_info structure to the taskprocessor container
- * \param t taskprocessor_singleton_info structure to add to the taskprocessor container
+/*! \brief Add a new ast_taskprocessor structure to the taskprocessor container
+ * \param t ast_taskprocessor structure to add to the taskprocessor container
  * \return 0 on success, -1 on error
  */
-static int tps_taskprocessor_add(struct taskprocessor_singleton_info *t)
-{
-	struct taskprocessor_singleton_info *n = NULL;
+static int tps_taskprocessor_add(struct ast_taskprocessor *t)
+{
+	struct ast_taskprocessor *n = NULL;
 
 	AST_LIST_LOCK(&_taskprocessor_singletons);
 	AST_LIST_TRAVERSE(&_taskprocessor_singletons, n, list) {
@@ -473,7 +473,7 @@
  * \param t task to push to taskprocessor
  * \return 0 on success, -1 on error
  */
-int ast_taskprocessor_push(struct taskprocessor_singleton_info *tps, struct a_task *t)
+int ast_taskprocessor_push(struct ast_taskprocessor *tps, struct ast_task *t)
 {
 	int lock_failures = 0;
 
@@ -506,9 +506,9 @@
  * \param tps taskprocessor to pop task from
  * \return task on success, NULL on error
  */
-struct a_task *ast_taskprocessor_pop(struct taskprocessor_singleton_info *tps)
-{
-	struct a_task *t = NULL;
+struct ast_task *ast_taskprocessor_pop(struct ast_taskprocessor *tps)
+{
+	struct ast_task *t = NULL;
 	int lock_failures = 0;
 
 	AST_LIST_LOCK(&tps->_queue);
@@ -535,7 +535,7 @@
  * \param tps taskprocessor to return queue depth
  * \return depth on success, -1 on error
  */
-int ast_taskprocessor_depth(struct taskprocessor_singleton_info *tps)
+int ast_taskprocessor_depth(struct ast_taskprocessor *tps)
 {
 	int size = -1;
 	int lock_failures = 0;




More information about the asterisk-commits mailing list