[multiple changes]
2008-02-10 Danny Smith <dannysmith@users.sourceforge.net> PR gcc/35063 * gthr-win32.h (__gthread_mutex_destroy_function): New function to CloseHandle after unlocking to prevent accumulation of handle count. 2008-02-10 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/35063 * io/unit.c (destroy_unit_mutex): New function that uses __gthread_mutex_destroy_function or pthread_mutex_destroy after unlocking and before free_mem for final closure of I/O unit. (delete_root): Use new function. (free_internal_unit): Likewise. (close_unit_1): Likewise. From-SVN: r132217
This commit is contained in:
parent
39caa16434
commit
ef4195d63d
4 changed files with 54 additions and 8 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-02-10 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
PR gcc/35063
|
||||
* gthr-win32.h (__gthread_mutex_destroy_function): New function
|
||||
to CloseHandle after unlocking to prevent accumulation of handle
|
||||
count.
|
||||
|
||||
2008-02-02 Hans-Peter Nilsson <hp@axis.com>
|
||||
|
||||
* configure.ac: Enable fortran for cris-*-elf and crisv32-*-elf.
|
||||
|
|
|
@ -359,6 +359,9 @@ typedef struct {
|
|||
__gthread_recursive_mutex_init_function
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0}
|
||||
|
||||
#define __GTHREAD_MUTEX_DESTROY_FUNCTION \
|
||||
__gthread_mutex_destroy_function
|
||||
|
||||
#if __MINGW32_MAJOR_VERSION >= 1 || \
|
||||
(__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2)
|
||||
#define MINGW32_SUPPORTS_MT_EH 1
|
||||
|
@ -615,6 +618,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
|
|||
mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
__gthread_mutex_destroy_function (__gthread_mutex_t *mutex)
|
||||
{
|
||||
CloseHandle ((HANDLE) mutex->sema);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_lock (__gthread_mutex_t *mutex)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2008-02-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR libfortran/35063
|
||||
* io/unit.c (destroy_unit_mutex): New function that uses
|
||||
__gthread_mutex_destroy_function or pthread_mutex_destroy after
|
||||
unlocking and before free_mem for final closure of I/O unit.
|
||||
(delete_root): Use new function.
|
||||
(free_internal_unit): Likewise.
|
||||
(close_unit_1): Likewise.
|
||||
|
||||
2008-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/35001
|
||||
|
|
|
@ -204,6 +204,22 @@ insert_unit (int n)
|
|||
}
|
||||
|
||||
|
||||
/* destroy_unit_mutex()-- Destroy the mutex and free memory of unit. */
|
||||
|
||||
static void
|
||||
destroy_unit_mutex (gfc_unit * u)
|
||||
{
|
||||
#ifdef __GTHREAD_MUTEX_DESTROY_FUNCTION
|
||||
__GTHREAD_MUTEX_DESTROY_FUNCTION (&u->lock);
|
||||
#else
|
||||
#ifdef __CYGWIN__
|
||||
pthread_mutex_destroy (&u->lock);
|
||||
#endif
|
||||
#endif
|
||||
free_mem (u);
|
||||
}
|
||||
|
||||
|
||||
static gfc_unit *
|
||||
delete_root (gfc_unit * t)
|
||||
{
|
||||
|
@ -341,7 +357,7 @@ found:
|
|||
__gthread_mutex_lock (&unit_lock);
|
||||
__gthread_mutex_unlock (&p->lock);
|
||||
if (predec_waiting_locked (p) == 0)
|
||||
free_mem (p);
|
||||
destroy_unit_mutex (p);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
|
@ -455,14 +471,18 @@ free_internal_unit (st_parameter_dt *dtp)
|
|||
if (!is_internal_unit (dtp))
|
||||
return;
|
||||
|
||||
if (dtp->u.p.current_unit->ls != NULL)
|
||||
free_mem (dtp->u.p.current_unit->ls);
|
||||
|
||||
sclose (dtp->u.p.current_unit->s);
|
||||
|
||||
if (dtp->u.p.current_unit != NULL)
|
||||
free_mem (dtp->u.p.current_unit);
|
||||
{
|
||||
if (dtp->u.p.current_unit->ls != NULL)
|
||||
free_mem (dtp->u.p.current_unit->ls);
|
||||
|
||||
if (dtp->u.p.current_unit->s)
|
||||
free_mem (dtp->u.p.current_unit->s);
|
||||
|
||||
destroy_unit_mutex (dtp->u.p.current_unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get_unit()-- Returns the unit structure associated with the integer
|
||||
|
@ -612,7 +632,7 @@ close_unit_1 (gfc_unit *u, int locked)
|
|||
avoid freeing the memory, the last such thread will free it
|
||||
instead. */
|
||||
if (u->waiting == 0)
|
||||
free_mem (u);
|
||||
destroy_unit_mutex (u);
|
||||
|
||||
if (!locked)
|
||||
__gthread_mutex_unlock (&unit_lock);
|
||||
|
|
Loading…
Add table
Reference in a new issue