[Asterisk-cvs] asterisk cdr.c,1.56,1.57 devicestate.c,1.10,1.11

kpfleming kpfleming
Fri Oct 28 12:43:07 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv870

Modified Files:
	cdr.c devicestate.c 
Log Message:
add 'ast_cond_t' type for pthread condition variables, and appropriate API wrappers


Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cdr.c	27 Oct 2005 21:57:53 -0000	1.56
+++ cdr.c	28 Oct 2005 16:35:43 -0000	1.57
@@ -91,7 +91,7 @@
 
 /* these are used to wake up the CDR thread when there's work to do */
 AST_MUTEX_DEFINE_STATIC(cdr_pending_lock);
-static pthread_cond_t cdr_pending_cond;
+static ast_cond_t cdr_pending_cond;
 
 /*
  * We do a lot of checking here in the CDR code to try to be sure we don't ever let a CDR slip
@@ -956,7 +956,7 @@
 	cdr_sched = ast_sched_add(sched, 1, submit_scheduled_batch, NULL);
 	/* signal the do_cdr thread to wakeup early and do some work (that lazy thread ;) */
 	ast_mutex_lock(&cdr_pending_lock);
-	pthread_cond_signal(&cdr_pending_cond);
+	ast_cond_signal(&cdr_pending_cond);
 	ast_mutex_unlock(&cdr_pending_lock);
 }
 
@@ -1032,7 +1032,7 @@
 		timeout.tv_nsec = (now.tv_usec * 1000) + ((schedms % 1000) * 1000);
 		/* prevent stuff from clobbering cdr_pending_cond, then wait on signals sent to it until the timeout expires */
 		ast_mutex_lock(&cdr_pending_lock);
-		ast_pthread_cond_timedwait(&cdr_pending_cond, &cdr_pending_lock, &timeout);
+		ast_cond_timedwait(&cdr_pending_cond, &cdr_pending_lock, &timeout);
 		numevents = ast_sched_runq(sched);
 		ast_mutex_unlock(&cdr_pending_lock);
 		if (option_debug > 1)
@@ -1179,7 +1179,7 @@
 	/* if this reload enabled the CDR batch mode, create the background thread
 	   if it does not exist */
 	if (enabled && batchmode && (!was_enabled || !was_batchmode) && (cdr_thread == AST_PTHREADT_NULL)) {
-		pthread_cond_init(&cdr_pending_cond, NULL);
+		ast_cond_init(&cdr_pending_cond, NULL);
 		pthread_attr_init(&attr);
 		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 		if (ast_pthread_create(&cdr_thread, &attr, do_cdr, NULL) < 0) {
@@ -1198,7 +1198,7 @@
 		pthread_kill(cdr_thread, SIGURG);
 		pthread_join(cdr_thread, NULL);
 		cdr_thread = AST_PTHREADT_NULL;
-		pthread_cond_destroy(&cdr_pending_cond);
+		ast_cond_destroy(&cdr_pending_cond);
 		ast_cli_unregister(&cli_submit);
 		ast_unregister_atexit(ast_cdr_engine_term);
 		res = 0;

Index: devicestate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/devicestate.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- devicestate.c	26 Oct 2005 15:34:34 -0000	1.10
+++ devicestate.c	28 Oct 2005 16:35:43 -0000	1.11
@@ -67,7 +67,7 @@
 static AST_LIST_HEAD_STATIC(state_changes, state_change);
 
 static pthread_t change_thread = AST_PTHREADT_NULL;
-static pthread_cond_t change_pending;
+static ast_cond_t change_pending;
 
 /*--- devstate2str: Find devicestate as text message for output */
 const char *devstate2str(int devstate) 
@@ -216,7 +216,7 @@
 		AST_LIST_INSERT_TAIL(&state_changes, change, list);
 		if (AST_LIST_FIRST(&state_changes) == change)
 			/* the list was empty, signal the thread */
-			pthread_cond_signal(&change_pending);
+			ast_cond_signal(&change_pending);
 		AST_LIST_UNLOCK(&state_changes);
 	}
 
@@ -260,7 +260,7 @@
 		} else {
 			/* there was no entry, so atomically unlock the list and wait for
 			   the condition to be signalled (returns with the lock held) */
-			ast_pthread_cond_wait(&change_pending, &state_changes.lock);
+			ast_cond_wait(&change_pending, &state_changes.lock);
 		}
 	}
 
@@ -272,7 +272,7 @@
 {
 	pthread_attr_t attr;
 
-	pthread_cond_init(&change_pending, NULL);
+	ast_cond_init(&change_pending, NULL);
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	if (ast_pthread_create(&change_thread, &attr, do_devstate_changes, NULL) < 0) {




More information about the svn-commits mailing list