diff options
Diffstat (limited to 'src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.c')
-rw-r--r-- | src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.c b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.c new file mode 100644 index 0000000000..53b66d1357 --- /dev/null +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.c @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*===================================================================== +** +** Source: testlib.c +** +** Purpose: Simple library that counts thread attach/detach notifications +** +** +**===================================================================*/ + +#include <palsuite.h> + +static int Count; + +BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + + if (fdwReason == DLL_PROCESS_ATTACH) + { + Count = 0; + } + else if (fdwReason == DLL_THREAD_ATTACH || + fdwReason == DLL_THREAD_DETACH) + { + Count++; + } + + return TRUE; +} + +#ifdef WIN32 +BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + return DllMain(hinstDLL, fdwReason, lpvReserved); +} +#endif + +#ifdef WIN32 +__declspec(dllexport) +#endif +int __stdcall GetCallCount() +{ + return Count; +} |