summaryrefslogtreecommitdiff
path: root/mysys/safemalloc.c
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@sun.com>2009-12-09 20:19:51 -0700
committerMarc Alff <marc.alff@sun.com>2009-12-09 20:19:51 -0700
commitc082955f0676efe069f30384102ba7807b49dee6 (patch)
treecc0a038191d1969182d5dd108c891ee10a436cc0 /mysys/safemalloc.c
parent6fd3866c6c104f8bc991d71583e627ae6fabe0ab (diff)
downloadmariadb-git-c082955f0676efe069f30384102ba7807b49dee6.tar.gz
WL#2360 Performance schema
Part III: mysys instrumentation
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r--mysys/safemalloc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index c484f1d4c54..675fa62380a 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -178,7 +178,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
irem->prev= NULL;
/* Add this remember structure to the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
+ mysql_mutex_lock(&THR_LOCK_malloc);
if ((irem->next= sf_malloc_root))
sf_malloc_root->prev= irem;
sf_malloc_root= irem;
@@ -188,7 +188,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
if (sf_malloc_cur_memory > sf_malloc_max_memory)
sf_malloc_max_memory= sf_malloc_cur_memory;
sf_malloc_count++;
- pthread_mutex_unlock(&THR_LOCK_malloc);
+ mysql_mutex_unlock(&THR_LOCK_malloc);
/* Set the memory to the aribtrary wierd value */
if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
@@ -291,7 +291,7 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
}
/* Remove this structure from the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
+ mysql_mutex_lock(&THR_LOCK_malloc);
if (irem->prev)
irem->prev->next= irem->next;
else
@@ -302,7 +302,7 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
/* Handle the statistics */
sf_malloc_cur_memory-= irem->datasize;
sf_malloc_count--;
- pthread_mutex_unlock(&THR_LOCK_malloc);
+ mysql_mutex_unlock(&THR_LOCK_malloc);
#ifndef HAVE_purify
/* Mark this data as free'ed */
@@ -365,7 +365,7 @@ void TERMINATE(FILE *file, uint flag)
{
struct st_irem *irem;
DBUG_ENTER("TERMINATE");
- pthread_mutex_lock(&THR_LOCK_malloc);
+ mysql_mutex_lock(&THR_LOCK_malloc);
/*
Report the difference between number of calls to
@@ -428,7 +428,7 @@ void TERMINATE(FILE *file, uint flag)
DBUG_PRINT("safe",("Maximum memory usage: %lu bytes (%luk)",
(ulong) sf_malloc_max_memory,
(ulong) (sf_malloc_max_memory + 1023L) /1024L));
- pthread_mutex_unlock(&THR_LOCK_malloc);
+ mysql_mutex_unlock(&THR_LOCK_malloc);
DBUG_VOID_RETURN;
}
@@ -505,7 +505,7 @@ int _sanity(const char *filename, uint lineno)
reg2 int flag=0;
uint count=0;
- pthread_mutex_lock(&THR_LOCK_malloc);
+ mysql_mutex_lock(&THR_LOCK_malloc);
#ifndef PEDANTIC_SAFEMALLOC
if (sf_malloc_tampered && (int) sf_malloc_count < 0)
sf_malloc_count=0;
@@ -513,7 +513,7 @@ int _sanity(const char *filename, uint lineno)
count=sf_malloc_count;
for (irem= sf_malloc_root; irem != NULL && count-- ; irem= irem->next)
flag+= _checkchunk (irem, filename, lineno);
- pthread_mutex_unlock(&THR_LOCK_malloc);
+ mysql_mutex_unlock(&THR_LOCK_malloc);
if (count || irem)
{
const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'";