From e470da85f7b9426eea03d66086c2822bf29e9b05 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 3 Mar 2011 23:37:20 +0000 Subject: Some cleanups, mostly x86_64 compat plus interlocked macros --- pthread_win32_attach_detach_np.c | 64 ---------------------------------------- 1 file changed, 64 deletions(-) (limited to 'pthread_win32_attach_detach_np.c') diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c index 7911fe1..bb83fd7 100644 --- a/pthread_win32_attach_detach_np.c +++ b/pthread_win32_attach_detach_np.c @@ -89,70 +89,6 @@ pthread_win32_process_attach_np () ptw32_smp_system = PTW32_FALSE; } -#endif - -#ifdef _WIN64 - -/* - * InterlockedCompareExchange routine in WIN64 is an intrinsic function. - * See PTW32_INTERLOCKED_COMPARE_EXCHANGE implement.h - */ - -#else - -#ifdef WINCE - - /* - * Load COREDLL and try to get address of InterlockedCompareExchange - */ - ptw32_h_kernel32 = LoadLibrary (TEXT ("COREDLL.DLL")); - -#else - - /* - * Load KERNEL32 and try to get address of InterlockedCompareExchange - */ - ptw32_h_kernel32 = LoadLibrary (TEXT ("KERNEL32.DLL")); - -#endif - - ptw32_interlocked_compare_exchange = - (PTW32_INTERLOCKED_LONG (WINAPI *) - (PTW32_INTERLOCKED_LPLONG, PTW32_INTERLOCKED_LONG, - PTW32_INTERLOCKED_LONG)) -#if defined(NEED_UNICODE_CONSTS) - GetProcAddress (ptw32_h_kernel32, - (const TCHAR *) TEXT ("InterlockedCompareExchange")); -#else - GetProcAddress (ptw32_h_kernel32, (LPCSTR) "InterlockedCompareExchange"); -#endif - - if (ptw32_interlocked_compare_exchange == NULL) - { - ptw32_interlocked_compare_exchange = ptw32_InterlockedCompareExchange; - - /* - * If InterlockedCompareExchange is not being used, then free - * the kernel32.dll handle now, rather than leaving it until - * DLL_PROCESS_DETACH. - * - * Note: this is not a pedantic exercise in freeing unused - * resources! It is a work-around for a bug in Windows 95 - * (see microsoft knowledge base article, Q187684) which - * does Bad Things when FreeLibrary is called within - * the DLL_PROCESS_DETACH code, in certain situations. - * Since w95 just happens to be a platform which does not - * provide InterlockedCompareExchange, the bug will be - * effortlessly avoided. - */ - (void) FreeLibrary (ptw32_h_kernel32); - ptw32_h_kernel32 = 0; - } - else - { - ptw32_features |= PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE; - } - #endif /* -- cgit v1.2.3