Преглед на файлове

Fix lockup on with 64 cores.

Thanks foi.
Iain Patterson преди 7 години
родител
ревизия
caeb3c4a6f
променени са 2 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 1 0
      README.txt
  2. 1 1
      nssm.cpp

+ 1 - 0
README.txt

@@ -1044,6 +1044,7 @@ Thanks to Meang Akira Tanaka for suggestion and initial implementation of
 the statuscode command.
 Thanks to Kirill Kovalenko for reporting a crash with NANO server.
 Thanks to Connor Reynolds for spotting a potential buffer overflow.
+Thanks to foi for spotting a hang with 64 cores.
 
 Licence
 -------

+ 1 - 1
nssm.cpp

@@ -223,7 +223,7 @@ static int elevate(int argc, TCHAR **argv, unsigned long message) {
 int num_cpus() {
   DWORD_PTR i, affinity, system_affinity;
   if (! GetProcessAffinityMask(GetCurrentProcess(), &affinity, &system_affinity)) return 64;
-  for (i = 0; system_affinity & (1LL << i); i++);
+  for (i = 0; system_affinity & (1LL << i); i++) if (i == 64) break;
   return (int) i;
 }