Debian Codegraph @

nsprpub/pr/src/md/windows/w95dllmain.c

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * The DLL entry point (DllMain) for NSPR.
8 *
9 * This is used to detach threads that were automatically attached by
10 * nspr.
11 */
12
13 #include <windows.h>
14 #include <primpl.h>
15
16 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
17 PRThread* me;
18
19 switch (fdwReason) {
20 case DLL_PROCESS_ATTACH:
21 break;
22 case DLL_THREAD_ATTACH:
23 break;
24 case DLL_THREAD_DETACH:
25 if (_pr_initialized) {
26 me = _MD_GET_ATTACHED_THREAD();
27 if ((me != NULL) && (me->flags & _PR_ATTACHED)) {
28 _PRI_DetachThread();
29 }
30 }
31 break;
32 case DLL_PROCESS_DETACH:
33 break;
34 }
35 return TRUE;
36 }