2001-07-06 05:36:13 +00:00
|
|
|
/*
|
2018-02-23 09:53:12 +01:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2001-07-06 05:36:13 +00:00
|
|
|
*
|
2016-06-27 14:56:38 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2018-02-23 09:53:12 +01:00
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
2001-07-06 05:36:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
2002-08-01 03:41:49 +00:00
|
|
|
#include <isc/os.h>
|
|
|
|
|
2001-07-06 05:36:13 +00:00
|
|
|
static BOOL bInit = FALSE;
|
|
|
|
static SYSTEM_INFO SystemInfo;
|
|
|
|
|
|
|
|
static void
|
|
|
|
initialize_action(void) {
|
2001-07-08 05:09:35 +00:00
|
|
|
if (bInit)
|
2001-07-06 05:36:13 +00:00
|
|
|
return;
|
2013-03-23 23:46:06 +00:00
|
|
|
|
2001-07-08 05:09:35 +00:00
|
|
|
GetSystemInfo(&SystemInfo);
|
2001-07-06 05:36:13 +00:00
|
|
|
bInit = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
isc_os_ncpus(void) {
|
2013-03-22 22:23:48 +11:00
|
|
|
long ncpus;
|
2001-07-06 05:36:13 +00:00
|
|
|
initialize_action();
|
|
|
|
ncpus = SystemInfo.dwNumberOfProcessors;
|
|
|
|
if (ncpus <= 0)
|
|
|
|
ncpus = 1;
|
|
|
|
|
|
|
|
return ((unsigned int)ncpus);
|
|
|
|
}
|