* cygwin.din: Wrap atexit and exit with cygwin, thread-safe functions.
* dcrt0.cc (cygwin_atexit): New function. (cygwin_exit): Ditto.
This commit is contained in:
@@ -34,6 +34,7 @@ details. */
|
||||
#include "cygwin_version.h"
|
||||
#include "dll_init.h"
|
||||
#include "cygthread.h"
|
||||
#include "sync.h"
|
||||
|
||||
#define MAX_AT_FILE_LEVEL 10
|
||||
|
||||
@@ -1064,6 +1065,28 @@ do_exit (int status)
|
||||
myself->exit (n);
|
||||
}
|
||||
|
||||
static muto *atexit_lock;
|
||||
|
||||
extern "C" int
|
||||
cygwin_atexit (void (*function)(void))
|
||||
{
|
||||
int res;
|
||||
if (!atexit_lock)
|
||||
new_muto (atexit_lock);
|
||||
atexit_lock->acquire ();
|
||||
res = atexit (function);
|
||||
atexit_lock->release ();
|
||||
return res;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
cygwin_exit (int n)
|
||||
{
|
||||
if (atexit_lock)
|
||||
atexit_lock->acquire ();
|
||||
exit (n);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
_exit (int n)
|
||||
{
|
||||
|
Reference in New Issue
Block a user