summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2012-11-29 17:16:50 +0000
committerDavid M. Lee <dlee@digium.com>2012-11-29 17:16:50 +0000
commit23c53c18c0db619efdc55f6c1669f458822f5327 (patch)
tree418ae5ffb092e8577891dc9b098ea180a1acdfce /main
parente46ea1fe6558e5af8a22c339aec313da3ba0f677 (diff)
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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/utils.c b/main/utils.c
index 1ea837109..24a8326a8 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1487,9 +1487,6 @@ int ast_remaining_ms(struct timeval start, int max_ms)
#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 @@ long int ast_random(void)
}
}
#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