diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-09 22:30:52 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-09 22:30:52 +0000 |
commit | 96465e7d59363b68d0a86473510c9431610fd827 (patch) | |
tree | 218726ba970bbec099f6565ccc5ecabbd59c0f21 /main/utils.c | |
parent | 8d0bd39ed2834f7b33e1697323fc0b177463137d (diff) |
Merged revisions 162414 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r162414 | russell | 2008-12-09 16:25:06 -0600 (Tue, 09 Dec 2008) | 16 lines
Merged revisions 162413 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r162413 | russell | 2008-12-09 16:17:39 -0600 (Tue, 09 Dec 2008) | 8 lines
Remove the test_for_thread_safety() function completely.
The test is not valid. Besides, if we actually suspected that recursive
mutexes were not working, we would get a ton of LOG_ERROR messages when
DEBUG_THREADS is turned on.
(inspired by a discussion on the asterisk-dev list)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@162415 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/main/utils.c b/main/utils.c index cb68cdc47..f599f2473 100644 --- a/main/utils.c +++ b/main/utils.c @@ -223,68 +223,6 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) return &hp->hp; } - - -AST_MUTEX_DEFINE_STATIC(test_lock); -AST_MUTEX_DEFINE_STATIC(test_lock2); -static pthread_t test_thread; -static int lock_count = 0; -static int test_errors = 0; - -/*! \brief This is a regression test for recursive mutexes. - test_for_thread_safety() will return 0 if recursive mutex locks are - working properly, and non-zero if they are not working properly. */ -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; -} - -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; - ast_pthread_create(&test_thread, NULL, test_thread_body, NULL); - usleep(100); - if (lock_count != 2) - test_errors++; - ast_mutex_unlock(&test_lock); - lock_count -= 1; - 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); - usleep(100); - if (lock_count != 0) - test_errors++; - pthread_join(test_thread, NULL); - return(test_errors); /* return 0 on success. */ -} - /*! \brief Produce 32 char MD5 hash of value. */ void ast_md5_hash(char *output, char *input) { |