* 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:
Christopher Faylor 2003-03-01 02:02:42 +00:00
parent 27b4082ae7
commit 005c3065eb
5 changed files with 53 additions and 12 deletions

View File

@ -1,7 +1,13 @@
2003-02-28 Christopher Faylor <cgf@redhat.com>
* cygwin.din: Wrap atexit and exit with cygwin, thread-safe functions.
* dcrt0.cc (cygwin_atexit): New function.
(cygwin_exit): Ditto.
2003-02-28 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (fstat64): Pass get_name () to pc.
(access): Pass fn to stat_worker.
(access): Pass fn to stat_worker.
2003-03-27 Corinna Vinschen <corinna@vinschen.de>
@ -11,7 +17,7 @@
class sock_event. Use class object instead.
(fhandler_socket::accept): Ditto. Remove useless casts.
2003-03-27 Thomas Pfaff <tpfaff@gmx.net>
2003-03-27 Thomas Pfaff <tpfaff@gmx.net>
* fhandler_socket.cc (fhandler_socket::connect): Add support for
an interruptable connect.
@ -139,8 +145,8 @@
(wincap_2000): Ditto.
(wincap_xp): Ditto.
* path.h (path_conv::fs_flags): New method.
* fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl.
(fhandler_disk_file::open): Set newly created and truncated files as
* fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl.
(fhandler_disk_file::open): Set newly created and truncated files as
sparse on platforms that support it.
2003-02-17 Pierre Humblet <pierre.humblet@ieee.org>
@ -168,7 +174,7 @@
from non-waitloop call.
2003-02-13 Vaclav Haisman <V.Haisman@sh.cvut.cz>
Christopher Faylor <cgf@redhat.com>
Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::write_normal): Use MessageBeep
for bell sound.

View File

@ -156,8 +156,8 @@ atanh
_atanh = atanh
atanhf
_atanhf = atanhf
atexit
_atexit = atexit
atexit = cygwin_atexit
_atexit = cygwin_atexit
atof
_atof = atof
atoff
@ -372,7 +372,7 @@ execve
_execve = execve
execvp
_execvp = execvp
exit
exit = cygwin_exit
exp
_exp = exp
exp2

View File

@ -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)
{

View File

@ -304,8 +304,16 @@ dll_list::load_after_fork (HANDLE parent, dll *first)
the parent had some of those. */
if (d.type == DLL_LOAD)
{
bool unload = true;
HMODULE h = LoadLibraryEx (d.name, NULL, DONT_RESOLVE_DLL_REFERENCES);
if (!h)
{
unload = false;
LoadLibrary (d.name);
}
if (!h)
system_printf ("can't reload %s", d.name);
/* See if DLL will load in proper place. If so, free it and reload
it the right way.
It sort of stinks that we can't invert the order of the FreeLibrary
@ -313,10 +321,13 @@ dll_list::load_after_fork (HANDLE parent, dll *first)
should do what we want. However, since the library was loaded above,
the second LoadLibrary does not execute it's startup code unless it
is first unloaded. */
if (h == d.handle)
else if (h == d.handle)
{
FreeLibrary (h);
LoadLibrary (d.name);
if (unload)
{
FreeLibrary (h);
LoadLibrary (d.name);
}
}
else if (try2)
api_fatal ("unable to remap %s to same address as parent(%p) != %p",

View File

@ -185,12 +185,13 @@ details. */
round roundf scalbln scalblnf sincos sincosf tgamma tgammaf
truncf
76: mallinfo
77: thread-safe exit/at_exit
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 76
#define CYGWIN_VERSION_API_MINOR 77
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible