1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
* malloc/Makefile: Change all references to memprof into memusage.
	* malloc/memprof.c: Rename to...
	* malloc/memusage.c: ...this.  New file.
	* malloc/memprof.sh: Rename to...
	* malloc/memusage.sh: ...this.  New file.
	* malloc/memprofstat.c: Rename to...
	* malloc/memusagestat.c: ...this.  New file.
This commit is contained in:
Ulrich Drepper
2000-06-20 04:46:22 +00:00
parent ea97f90c9a
commit ba80a015ee
9 changed files with 135 additions and 73 deletions

View File

@@ -1,3 +1,15 @@
2000-06-19 H.J. Lu <hjl@gnu.org>
* spinlock.h (HAS_COMPARE_AND_SWAP): Defined if
HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS is defined.
(compare_and_swap_with_release_semantics): New. Default to
compare_and_swap if HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
is not defined.
* spinlock.c (__pthread_unlock): Call
compare_and_swap_with_release_semantics () instead of
compare_and_swap ().
2000-06-19 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/timer_create.c: Use _set_errno instead of assigning

View File

@@ -95,7 +95,9 @@ again:
/* No threads are waiting for this lock. Please note that we also
enter this case if the lock is not taken at all. If this wouldn't
be done here we would crash further down. */
if (! compare_and_swap(&lock->__status, oldstatus, 0, &lock->__spinlock))
if (! compare_and_swap_with_release_semantics (&lock->__status,
oldstatus, 0,
&lock->__spinlock))
goto again;
return 0;
}
@@ -126,9 +128,9 @@ again:
/* If max prio thread is at head, remove it with compare-and-swap
to guard against concurrent lock operation */
thr = (pthread_descr) oldstatus;
if (! compare_and_swap(&lock->__status,
oldstatus, (long)(thr->p_nextlock),
&lock->__spinlock))
if (! compare_and_swap_with_release_semantics
(&lock->__status, oldstatus, (long)(thr->p_nextlock),
&lock->__spinlock))
goto again;
} else {
/* No risk of concurrent access, remove max prio thread normally */

View File

@@ -12,6 +12,25 @@
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Library General Public License for more details. */
/* There are 2 compare and swap synchronization primitives with
different semantics:
1. compare_and_swap, which has acquire semantics (i.e. it
completes befor subsequent writes.)
2. compare_and_swap_with_release_semantics, which has release
semantics (it completes after previous writes.)
For those platforms on which they are the same. HAS_COMPARE_AND_SWAP
should be defined. For those platforms on which they are different,
HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS has to be defined. */
#ifndef HAS_COMPARE_AND_SWAP
#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
#define HAS_COMPARE_AND_SWAP
#endif
#endif
#if defined(TEST_FOR_COMPARE_AND_SWAP)
extern int __pthread_has_cas;
@@ -29,6 +48,18 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
#elif defined(HAS_COMPARE_AND_SWAP)
#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
static inline int
compare_and_swap_with_release_semantics (long * ptr, long oldval,
long newval, int * spinlock)
{
return __compare_and_swap_with_release_semantics (ptr, oldval,
newval);
}
#endif
static inline int compare_and_swap(long * ptr, long oldval, long newval,
int * spinlock)
{
@@ -48,6 +79,10 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
#endif
#ifndef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
#define compare_and_swap_with_release_semantics compare_and_swap
#endif
/* Internal locks */
extern void internal_function __pthread_lock(struct _pthread_fastlock * lock,