Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed returned number of processors on Mac OSX. #17

Open
wants to merge 1 commit into from

3 participants

@bamse16

Fixed returned number of processors on Mac OSX. Tested on Mac OSX (and Ubuntu).
Source: http://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine

@goodluckart

Works for me :+1: (Gentoo Linux)

@WyseNynja

Samr7 hasn't been active with this repo so I merged this into my fork at https://github.com/WyseNynja/vanitygen. It's easy to install with my brew tap at https://github.com/WyseNynja/homebrew-bitcoin and has various other fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 14 deletions.
  1. +1 −14 vanitygen.c
View
15 vanitygen.c
@@ -244,20 +244,7 @@ vg_thread_loop(void *arg)
int
count_processors(void)
{
- FILE *fp;
- char buf[512];
- int count = 0;
-
- fp = fopen("/proc/cpuinfo", "r");
- if (!fp)
- return -1;
-
- while (fgets(buf, sizeof(buf), fp)) {
- if (!strncmp(buf, "processor\t", 10))
- count += 1;
- }
- fclose(fp);
- return count;
+ return sysconf( _SC_NPROCESSORS_ONLN );
}
#endif
Something went wrong with that request. Please try again.