summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-12-16 15:57:56 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2010-12-16 15:57:56 +0000
commit47cf7c7e49052cc93331d69c876e2e5e6a44e5d3 (patch)
tree4eabe71cb4afd827da64c6849443a57e2ce8abf4 /libc/stdlib
parente7de0d4fc0526318aa0be1fcb6ec60cf27ce18c7 (diff)
Merge changes between r12228 and r12321 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@12322 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/msort.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/stdlib/msort.c b/libc/stdlib/msort.c
index 35cd4d031..fc58f0d41 100644
--- a/libc/stdlib/msort.c
+++ b/libc/stdlib/msort.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <memcopy.h>
#include <errno.h>
+#include <atomic.h>
struct msort_param
{
@@ -182,7 +183,7 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg)
static long int phys_pages;
static int pagesize;
- if (phys_pages == 0)
+ if (pagesize == 0)
{
phys_pages = __sysconf (_SC_PHYS_PAGES);
@@ -197,6 +198,9 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg)
a quarter of the physical memory. */
phys_pages /= 4;
+ /* Make sure phys_pages is written to memory. */
+ atomic_write_barrier ();
+
pagesize = __sysconf (_SC_PAGESIZE);
}