summaryrefslogtreecommitdiff
path: root/pthread_win32_attach_detach_np.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-10-16 02:34:44 +0000
committerrpj <rpj>2004-10-16 02:34:44 +0000
commit45b1b8cb2a6588f9316f780d8cefe11c181a9a17 (patch)
tree24753e298d9933d48d764177baf183ef97f04156 /pthread_win32_attach_detach_np.c
parent9da8fdcb33373b4b2e1de2a8b7af3ed4b5811245 (diff)
Mutex speedups cont'd
Diffstat (limited to 'pthread_win32_attach_detach_np.c')
-rw-r--r--pthread_win32_attach_detach_np.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c
index ea0a307..4aedccc 100644
--- a/pthread_win32_attach_detach_np.c
+++ b/pthread_win32_attach_detach_np.c
@@ -52,14 +52,46 @@ BOOL
pthread_win32_process_attach_np ()
{
BOOL result = TRUE;
+ DWORD_PTR vProcessCPUs;
+ DWORD_PTR vSystemCPUs;
result = ptw32_processInitialize ();
+
#ifdef _UWIN
pthread_count++;
#endif
ptw32_features = 0;
+
+#if defined(NEED_PROCESS_AFFINITY_MASK)
+
+ ptw32_smp_system = PTW32_FALSE;
+
+#else
+
+ if (GetProcessAffinityMask (GetCurrentProcess (),
+ &vProcessCPUs, &vSystemCPUs))
+ {
+ int CPUs = 0;
+ DWORD_PTR bit;
+
+ for (bit = 1; bit != 0; bit <<= 1)
+ {
+ if (vSystemCPUs & bit)
+ {
+ CPUs++;
+ }
+ }
+ ptw32_smp_system = (CPUs > 1);
+ }
+ else
+ {
+ ptw32_smp_system = PTW32_FALSE;
+ }
+
+#endif
+
#ifndef TEST_ICE
/*