mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-11 11:33:43 +01:00
(sos_alloc): Fix call to cmpxchg_ptr().
(Logical change 1.136)
This commit is contained in:
parent
7661874fbe
commit
ac224b48bb
1 changed files with 3 additions and 3 deletions
|
@ -48,11 +48,12 @@ sos_alloc (size_t size)
|
||||||
#ifdef HAVE_CMPXCHG
|
#ifdef HAVE_CMPXCHG
|
||||||
union {
|
union {
|
||||||
long *lp;
|
long *lp;
|
||||||
char *cp;
|
char **cp;
|
||||||
} u;
|
} u;
|
||||||
char *old_mem;
|
char *old_mem;
|
||||||
|
|
||||||
size = (size + MAX_ALIGN - 1) & -MAX_ALIGN;
|
size = (size + MAX_ALIGN - 1) & -MAX_ALIGN;
|
||||||
|
u.cp = &sos_memp;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
old_mem = sos_memp;
|
old_mem = sos_memp;
|
||||||
|
@ -61,9 +62,8 @@ sos_alloc (size_t size)
|
||||||
mem += size;
|
mem += size;
|
||||||
if (mem >= sos_memory + sizeof (sos_memory))
|
if (mem >= sos_memory + sizeof (sos_memory))
|
||||||
abort ();
|
abort ();
|
||||||
u.cp = sos_memp;
|
|
||||||
}
|
}
|
||||||
while (!cmpxchg_ptr (&u.lp, old_mem, mem));
|
while (!cmpxchg_ptr (u.lp, old_mem, mem));
|
||||||
#else
|
#else
|
||||||
static pthread_mutex_t sos_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t sos_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
sigset_t saved_sigmask;
|
sigset_t saved_sigmask;
|
||||||
|
|
Loading…
Reference in a new issue