[Asterisk-cvs] asterisk utils.c,1.9,1.10

citats at lists.digium.com citats at lists.digium.com
Tue Jun 22 16:07:41 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/home/citats/cvs/asterisk

Modified Files:
	utils.c 
Log Message:
Code formatting cleanups in utils.c and include/asterisk/lock.h

Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- utils.c	22 Jun 2004 18:48:59 -0000	1.9
+++ utils.c	22 Jun 2004 19:53:36 -0000	1.10
@@ -158,46 +158,54 @@
 
 static void *test_thread_body(void *data) 
 { 
-  ast_mutex_lock(&test_lock);
-  lock_count += 10;
-  if(lock_count != 10) test_errors++;
-  ast_mutex_lock(&test_lock);
-  lock_count += 10;
-  if(lock_count != 20) test_errors++;
-  ast_mutex_lock(&test_lock2);
-  ast_mutex_unlock(&test_lock);
-  lock_count -= 10;
-  if(lock_count != 10) test_errors++;
-  ast_mutex_unlock(&test_lock);
-  lock_count -= 10;
-  ast_mutex_unlock(&test_lock2);
-  if(lock_count != 0) test_errors++;
-  return NULL;
+	ast_mutex_lock(&test_lock);
+	lock_count += 10;
+	if (lock_count != 10) 
+		test_errors++;
+	ast_mutex_lock(&test_lock);
+	lock_count += 10;
+	if (lock_count != 20) 
+		test_errors++;
+	ast_mutex_lock(&test_lock2);
+	ast_mutex_unlock(&test_lock);
+	lock_count -= 10;
+	if (lock_count != 10) 
+		test_errors++;
+	ast_mutex_unlock(&test_lock);
+	lock_count -= 10;
+	ast_mutex_unlock(&test_lock2);
+	if (lock_count != 0) 
+		test_errors++;
+	return NULL;
 } 
 
 int test_for_thread_safety(void)
 { 
-  ast_mutex_lock(&test_lock2);
-  ast_mutex_lock(&test_lock);
-  lock_count += 1;
-  ast_mutex_lock(&test_lock);
-  lock_count += 1;
-  pthread_create(&test_thread, NULL, test_thread_body, NULL); 
-  pthread_yield();
-  usleep(100);
-  if(lock_count != 2) test_errors++;
-  ast_mutex_unlock(&test_lock);
-  lock_count -= 1;
-  pthread_yield(); 
-  usleep(100); 
-  if(lock_count != 1) test_errors++;
-  ast_mutex_unlock(&test_lock);
-  lock_count -= 1;
-  if(lock_count != 0) test_errors++;
-  ast_mutex_unlock(&test_lock2);
-  pthread_yield();
-  usleep(100);
-  if(lock_count != 0) test_errors++;
-  pthread_join(test_thread, NULL);
-  return(test_errors);          /* return 0 on success. */
+	ast_mutex_lock(&test_lock2);
+	ast_mutex_lock(&test_lock);
+	lock_count += 1;
+	ast_mutex_lock(&test_lock);
+	lock_count += 1;
+	pthread_create(&test_thread, NULL, test_thread_body, NULL); 
+	pthread_yield();
+	usleep(100);
+	if (lock_count != 2) 
+		test_errors++;
+	ast_mutex_unlock(&test_lock);
+	lock_count -= 1;
+	pthread_yield(); 
+	usleep(100); 
+	if (lock_count != 1) 
+		test_errors++;
+	ast_mutex_unlock(&test_lock);
+	lock_count -= 1;
+	if (lock_count != 0) 
+		test_errors++;
+	ast_mutex_unlock(&test_lock2);
+	pthread_yield();
+	usleep(100);
+	if (lock_count != 0) 
+		test_errors++;
+	pthread_join(test_thread, NULL);
+	return(test_errors);          /* return 0 on success. */
 }




More information about the svn-commits mailing list