3 Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
14 #include "perprocess.h"
16 extern HMODULE cygwin_hmodule;
18 int NO_COPY dynamically_loaded;
21 WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load)
25 case DLL_PROCESS_ATTACH:
26 cygwin_hmodule = (HMODULE) h;
27 dynamically_loaded = (static_load == NULL);
29 case DLL_THREAD_ATTACH:
30 if (user_data->threadinterface)
32 if (!TlsSetValue(user_data->threadinterface->reent_index,
33 &user_data->threadinterface->reents))
34 api_fatal("Sig proc MT init failed\n");
37 case DLL_PROCESS_DETACH:
39 case DLL_THREAD_DETACH:
40 #if 0 // FIXME: REINSTATE SOON
42 if ((w = waitq_storage.get ()) != NULL)
44 if (w->thread_ev != NULL)
46 system_printf ("closing %p", w->thread_ev);
47 (void) CloseHandle (w->thread_ev);
49 memset (w, 0, sizeof(*w)); // FIXME: memory leak
51 // FIXME: Need to add other per_thread stuff here