functions.
(__register_exitproc): Use __atexit_lock rather than a local static lock.
* libc/stdlib/__call_atexit.c: Ditto.
+2010-02-01 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * libc/stdlib/__atexit.c (__atexit_lock): Define a global lock for
+ atexit functions.
+ (__register_exitproc): Use __atexit_lock rather than a local static
+ lock.
+ * libc/stdlib/__call_atexit.c: Ditto.
+
2010-01-29 Jeff Johnston <jjohnstn@redhat.com>
* libc/search/Makefile.am: Create .def files for bsearch and qsort.
/* Make this a weak reference to avoid pulling in malloc. */
void * malloc(size_t) _ATTRIBUTE((__weak__));
+__LOCK_INIT(, __atexit_lock);
/*
* Register a function to be performed at exit or on shared library unload.
register struct _atexit *p;
#ifndef __SINGLE_THREAD__
- __LOCK_INIT(static, lock);
-
- __lock_acquire(lock);
+ __lock_acquire(__atexit_lock);
#endif
p = _GLOBAL_REENT->_atexit;
if (p == NULL)
{
#ifndef __SINGLE_THREAD__
- __lock_release(lock);
+ __lock_release(__atexit_lock);
#endif
return -1;
}
}
p->_fns[p->_ind++] = fn;
#ifndef __SINGLE_THREAD__
- __lock_release(lock);
+ __lock_release(__atexit_lock);
#endif
return 0;
}
/* Make this a weak reference to avoid pulling in free. */
void free(void *) _ATTRIBUTE((__weak__));
+#ifndef __SINGLE_THREAD__
+extern _LOCK_T __atexit_lock;
+#endif
+
/*
* Call registered exit handlers. If D is null then all handlers are called,
* otherwise only the handlers from that DSO are called.
int i;
void (*fn) (void);
+
+#ifndef __SINGLE_THREAD__
+ __lock_acquire(__atexit_lock);
+#endif
+
restart:
p = _GLOBAL_REENT->_atexit;
}
#endif
}
+#ifndef __SINGLE_THREAD__
+ __lock_release(__atexit_lock);
+#endif
+
}