Anonymous avatar Anonymous committed 45c53c0

added windows lean_and_mean flag, removed some comments, main correctly sets runtime.GOMAXPROCS via nproc.Conf

Comments (0)

Files changed (2)

 func main() {
-	cnt := nproc.Onln()
+	cnt := nproc.Conf()
 	fmt.Println("previous: ", runtime.GOMAXPROCS(cnt))
 	fmt.Println("current: ", cnt)
-	fmt.Println("Conf: ", nproc.Conf())
-	fmt.Println("Max: ", nproc.Max())
+	fmt.Println("Conf: ", nproc.Onln())
 #if defined(__WINDOWS__)
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #elif defined(__LINUX__) || defined(__DARWIN__) || defined(__FREEBSD__)
 #include <unistd.h>
 #error "Invalid GOOS: must be darwin, freebsd, linux, or windows"
-// _SC_NPROCESSORS_ONLN  Number of online processors (available starting in darwin 10.3)
-// _SC_NPROCESSORS_CONF  Number of configured processors
-// _SC_NPROCESSORS_MAX   Max number of processors supported by platform
-// _SC_NPROCESSES	      Number of processes per real user id
+//  Number of online processors
 int onln(void) {
 #if defined(__WINDOWS__)
 	SYSTEM_INFO sysinfo;
+//  Number of configured processors
 int conf(void) {
 #if defined(__WINDOWS__)
 	return onln();
 	return sysconf(_SC_NPROCESSORS_CONF);
-int max(void) {
-#if defined(__LINUX__)
-	return sysconf(_SC_NPROCESSORS_MAX);
-	return conf();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.