2001-07-06 01:36:13 -04:00
|
|
|
/*
|
2018-02-23 03:53:12 -05:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2001-07-06 01:36:13 -04:00
|
|
|
*
|
2016-06-27 00:56:38 -04: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 03:53:12 -05:00
|
|
|
*
|
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
|
* information regarding copyright ownership.
|
2001-07-06 01:36:13 -04:00
|
|
|
*/
|
|
|
|
|
|
2007-06-19 19:47:24 -04:00
|
|
|
/* $Id: os.c,v 1.8 2007/06/19 23:47:19 tbox Exp $ */
|
2001-07-06 01:36:13 -04:00
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
2002-07-31 23:41:49 -04:00
|
|
|
#include <isc/os.h>
|
|
|
|
|
|
2001-07-06 01:36:13 -04:00
|
|
|
static BOOL bInit = FALSE;
|
|
|
|
|
static SYSTEM_INFO SystemInfo;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
initialize_action(void) {
|
2001-07-08 01:09:35 -04:00
|
|
|
if (bInit)
|
2001-07-06 01:36:13 -04:00
|
|
|
return;
|
2013-03-23 19:46:06 -04:00
|
|
|
|
2001-07-08 01:09:35 -04:00
|
|
|
GetSystemInfo(&SystemInfo);
|
2001-07-06 01:36:13 -04:00
|
|
|
bInit = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
isc_os_ncpus(void) {
|
2013-03-22 07:23:48 -04:00
|
|
|
long ncpus;
|
2001-07-06 01:36:13 -04:00
|
|
|
initialize_action();
|
|
|
|
|
ncpus = SystemInfo.dwNumberOfProcessors;
|
|
|
|
|
if (ncpus <= 0)
|
|
|
|
|
ncpus = 1;
|
|
|
|
|
|
|
|
|
|
return ((unsigned int)ncpus);
|
|
|
|
|
}
|