summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dll_init.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-08-21 21:32:06 +0000
committerChristopher Faylor <me@cgf.cx>2009-08-21 21:32:06 +0000
commit6282fe16ddf562366d87d7e23ba3b63413cb0218 (patch)
treed007b9daa192e004c18c86cb5185df3c12fd8f9d /winsup/cygwin/dll_init.h
parente41f43a1a675ee6d0f21f2ab611c97ffe9c22088 (diff)
downloadcygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.tar.gz
cygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.tar.bz2
cygnal-6282fe16ddf562366d87d7e23ba3b63413cb0218.zip
* dll_init.h (has_dtors): New flag.
(run_dtors): New wrapper function which avoids calling dtors more than once. * dll_init.cc (dll_global_dtors): Use dll.run_dtors wrapper. (dll_list::detach): Ditto. (dll_list::alloc): Set has_dtors flag.
Diffstat (limited to 'winsup/cygwin/dll_init.h')
-rw-r--r--winsup/cygwin/dll_init.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h
index 9a712a3cc..90cfa03e2 100644
--- a/winsup/cygwin/dll_init.h
+++ b/winsup/cygwin/dll_init.h
@@ -50,10 +50,19 @@ struct dll
per_module p;
HMODULE handle;
int count;
+ bool has_dtors;
dll_type type;
WCHAR name[1];
void detach ();
int init ();
+ void run_dtors ()
+ {
+ if (has_dtors)
+ {
+ has_dtors = 0;
+ p.run_dtors ();
+ }
+ }
};
#define MAX_DLL_BEFORE_INIT 100