mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-02 16:23:56 +08:00
eh_alloc.cc (__cxa_allocate_exception): Don't terminate holding the mutex.
* libsupc++/eh_alloc.cc (__cxa_allocate_exception): Don't terminate holding the mutex. Make sure size fits in EMERGENCY_OBJ_SIZE. From-SVN: r41296
This commit is contained in:
parent
0fb3018cd8
commit
f847167e3d
@ -1,3 +1,8 @@
|
|||||||
|
2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
* libsupc++/eh_alloc.cc (__cxa_allocate_exception): Don't
|
||||||
|
terminate holding the mutex. Make sure size fits in EMERGENCY_OBJ_SIZE.
|
||||||
|
|
||||||
2001-04-12 Gabriel Dos Reis <gdr@codesourcery.com>
|
2001-04-12 Gabriel Dos Reis <gdr@codesourcery.com>
|
||||||
|
|
||||||
* testsuite/README: Add DejaGnu specific documentation.
|
* testsuite/README: Add DejaGnu specific documentation.
|
||||||
|
@ -113,19 +113,24 @@ __cxa_allocate_exception(std::size_t thrown_size)
|
|||||||
bitmask_type used = emergency_used;
|
bitmask_type used = emergency_used;
|
||||||
unsigned int which = 0;
|
unsigned int which = 0;
|
||||||
|
|
||||||
|
if (thrown_size > EMERGENCY_OBJ_SIZE)
|
||||||
|
goto failed;
|
||||||
while (used & 1)
|
while (used & 1)
|
||||||
{
|
{
|
||||||
used >>= 1;
|
used >>= 1;
|
||||||
if (++which >= EMERGENCY_OBJ_COUNT)
|
if (++which >= EMERGENCY_OBJ_COUNT)
|
||||||
std::terminate ();
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
emergency_used |= (bitmask_type)1 << which;
|
emergency_used |= (bitmask_type)1 << which;
|
||||||
ret = &emergency_buffer[which][0];
|
ret = &emergency_buffer[which][0];
|
||||||
|
|
||||||
|
failed:;
|
||||||
#ifdef __GTHREADS
|
#ifdef __GTHREADS
|
||||||
__gthread_mutex_unlock (&emergency_mutex);
|
__gthread_mutex_unlock (&emergency_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
if (!ret)
|
||||||
|
std::terminate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (ret, 0, sizeof (__cxa_exception));
|
memset (ret, 0, sizeof (__cxa_exception));
|
||||||
|
Loading…
Reference in New Issue
Block a user