Skip to content

Commit

Permalink
Merge pull request #2 from jserv/macos-support
Browse files Browse the repository at this point in the history
Don't assume availability of get_nprocs_conf()
  • Loading branch information
WEI, CHEN committed Mar 15, 2018
2 parents 4d4ccb5 + 5a68f81 commit 4e1340d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/pow_sse.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,28 @@
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <sys/sysinfo.h>
#include "pow_sse.h"
#include "./hash/curl.h"
#include "constants.h"

/* Required for get_nprocs_conf() on Linux */
#ifdef NPROCS
#include <sys/sysinfo.h>
#endif

/* On Mac OS X, define our own get_nprocs_conf() */
#if defined (__APPLE__) || defined(__FreeBSD__)
#include <sys/sysctl.h>
unsigned int get_nprocs_conf()
{
int numProcessors = 0;
size_t size = sizeof(numProcessors);
if (sysctlbyname("hw.ncpu", &numProcessors, &size, NULL, 0)) return 1;
return (unsigned int) numProcessors;
}
#define NPROCS
#endif

pthread_mutex_t *pow_sse_mutex;
int *stopSSE;
long long int *countSSE;
Expand Down

0 comments on commit 4e1340d

Please sign in to comment.