mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-24 19:36:30 +08:00
gthr-vxworks.h (__ehdtor): Fix memory leak.
* gthr-vxworks.h (__ehdtor): Fix memory leak. The delete hook runs in the context of the deleter, not the deletee, so we must use taskVarGet to find the correct memory to free. (__gthread_key_create): Initialize the task variable subsystem so that the task variable is still active when the delete hook is run. From-SVN: r24079
This commit is contained in:
parent
9f643ff81d
commit
0fcff08299
@ -1,3 +1,12 @@
|
|||||||
|
Thu Dec 3 11:19:50 1998 Mike Stump <mrs@wrs.com>
|
||||||
|
|
||||||
|
* gthr-vxworks.h (__ehdtor): Fix memory leak. The delete hook
|
||||||
|
runs in the context of the deleter, not the deletee, so we must
|
||||||
|
use taskVarGet to find the correct memory to free.
|
||||||
|
(__gthread_key_create): Initialize the task
|
||||||
|
variable subsystem so that the task variable is still active when
|
||||||
|
the delete hook is run.
|
||||||
|
|
||||||
1998-12-03 Joseph S. Myers <jsm28@cam.ac.uk>
|
1998-12-03 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||||
|
|
||||||
* pdp11.h (TARGET_40_PLUS): Fix typo.
|
* pdp11.h (TARGET_40_PLUS): Fix typo.
|
||||||
|
@ -60,11 +60,16 @@ extern __gthread_key_t eh_context_key;
|
|||||||
don't map well enough onto VxWorks. */
|
don't map well enough onto VxWorks. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__ehdtor ()
|
__ehdtor (void *pTcb)
|
||||||
{
|
{
|
||||||
if (eh_context_key)
|
int tid = (int) pTcb;
|
||||||
free ((void*)eh_context_key);
|
void *p = (void*)taskVarGet(tid, &eh_context_key);
|
||||||
eh_context_key = 0;
|
if (p != (void*)-1)
|
||||||
|
{
|
||||||
|
if (p)
|
||||||
|
free (p);
|
||||||
|
taskVarSet(tid, &eh_context_key, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This only works for the code in libgcc2.c. */
|
/* This only works for the code in libgcc2.c. */
|
||||||
@ -74,6 +79,11 @@ __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
|
|||||||
{
|
{
|
||||||
*key = 0;
|
*key = 0;
|
||||||
|
|
||||||
|
/* Do this first so that the task variables are visible during the
|
||||||
|
running of the delete hook. */
|
||||||
|
|
||||||
|
taskVarInit();
|
||||||
|
|
||||||
/* We don't have a way to track dtor here, so instead, we
|
/* We don't have a way to track dtor here, so instead, we
|
||||||
register a generic routine that can cleanup any task. */
|
register a generic routine that can cleanup any task. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user