[asterisk-commits] dlee: trunk r376821 - /trunk/main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 29 11:16:54 CST 2012


Author: dlee
Date: Thu Nov 29 11:16:50 2012
New Revision: 376821

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376821
Log:
Fixed ast_random's comment about locking.

The original comment was separated from the code at some point, and didn't
reflect the use of libc's other than glibc for Linux.

Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/utils.c?view=diff&rev=376821&r1=376820&r2=376821
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Thu Nov 29 11:16:50 2012
@@ -1487,9 +1487,6 @@
 
 #undef ONE_MILLION
 
-/*! \brief glibc puts a lock inside random(3), so that the results are thread-safe.
- * BSD libc (and others) do not. */
-
 #ifndef linux
 AST_MUTEX_DEFINE_STATIC(randomlock);
 #endif
@@ -1508,6 +1505,13 @@
 		}
 	}
 #endif
+	/* XXX - Thread safety really depends on the libc, not the OS.
+	 *
+	 * But... popular Linux libc's (uClibc, glibc, eglibc), all have a
+	 * somewhat thread safe random(3) (results are random, but not
+	 * reproducible). The libc's for other systems (BSD, et al.), not so
+	 * much.
+	 */
 #ifdef linux
 	res = random();
 #else




More information about the asterisk-commits mailing list