4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-03-02 13:05:42 +08:00

* 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> 2003-02-28 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (fstat64): Pass get_name () to pc. * 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> 2003-03-27 Corinna Vinschen <corinna@vinschen.de>
@ -11,7 +17,7 @@
class sock_event. Use class object instead. class sock_event. Use class object instead.
(fhandler_socket::accept): Ditto. Remove useless casts. (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 * fhandler_socket.cc (fhandler_socket::connect): Add support for
an interruptable connect. an interruptable connect.
@ -139,8 +145,8 @@
(wincap_2000): Ditto. (wincap_2000): Ditto.
(wincap_xp): Ditto. (wincap_xp): Ditto.
* path.h (path_conv::fs_flags): New method. * path.h (path_conv::fs_flags): New method.
* fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl. * fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl.
(fhandler_disk_file::open): Set newly created and truncated files as (fhandler_disk_file::open): Set newly created and truncated files as
sparse on platforms that support it. sparse on platforms that support it.
2003-02-17 Pierre Humblet <pierre.humblet@ieee.org> 2003-02-17 Pierre Humblet <pierre.humblet@ieee.org>
@ -168,7 +174,7 @@
from non-waitloop call. from non-waitloop call.
2003-02-13 Vaclav Haisman <V.Haisman@sh.cvut.cz> 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 * fhandler_console.cc (fhandler_console::write_normal): Use MessageBeep
for bell sound. for bell sound.

View File

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

View File

@ -34,6 +34,7 @@ details. */
#include "cygwin_version.h" #include "cygwin_version.h"
#include "dll_init.h" #include "dll_init.h"
#include "cygthread.h" #include "cygthread.h"
#include "sync.h"
#define MAX_AT_FILE_LEVEL 10 #define MAX_AT_FILE_LEVEL 10
@ -1064,6 +1065,28 @@ do_exit (int status)
myself->exit (n); 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 extern "C" void
_exit (int n) _exit (int n)
{ {

View File

@ -304,8 +304,16 @@ dll_list::load_after_fork (HANDLE parent, dll *first)
the parent had some of those. */ the parent had some of those. */
if (d.type == DLL_LOAD) if (d.type == DLL_LOAD)
{ {
bool unload = true;
HMODULE h = LoadLibraryEx (d.name, NULL, DONT_RESOLVE_DLL_REFERENCES); 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 /* See if DLL will load in proper place. If so, free it and reload
it the right way. it the right way.
It sort of stinks that we can't invert the order of the FreeLibrary 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, should do what we want. However, since the library was loaded above,
the second LoadLibrary does not execute it's startup code unless it the second LoadLibrary does not execute it's startup code unless it
is first unloaded. */ is first unloaded. */
if (h == d.handle) else if (h == d.handle)
{ {
FreeLibrary (h); if (unload)
LoadLibrary (d.name); {
FreeLibrary (h);
LoadLibrary (d.name);
}
} }
else if (try2) else if (try2)
api_fatal ("unable to remap %s to same address as parent(%p) != %p", 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 round roundf scalbln scalblnf sincos sincosf tgamma tgammaf
truncf truncf
76: mallinfo 76: mallinfo
77: thread-safe exit/at_exit
*/ */
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0 #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 /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible