Merge pull request #53 from clbr/fixes

Fix scheduling policy change on Linux
This commit is contained in:
pooler 2014-01-15 05:01:03 -08:00
commit 2f824f22eb

View file

@ -47,6 +47,7 @@
static inline void drop_policy(void) static inline void drop_policy(void)
{ {
struct sched_param param; struct sched_param param;
param.sched_priority = 0;
#ifdef SCHED_IDLE #ifdef SCHED_IDLE
if (unlikely(sched_setscheduler(0, SCHED_IDLE, &param) == -1)) if (unlikely(sched_setscheduler(0, SCHED_IDLE, &param) == -1))
@ -124,7 +125,7 @@ static bool opt_quiet = false;
static int opt_retries = -1; static int opt_retries = -1;
static int opt_fail_pause = 30; static int opt_fail_pause = 30;
int opt_timeout = 270; int opt_timeout = 270;
int opt_scantime = 5; static int opt_scantime = 5;
static json_t *opt_config; static json_t *opt_config;
static const bool opt_time = true; static const bool opt_time = true;
static enum sha256_algos opt_algo = ALGO_SCRYPT; static enum sha256_algos opt_algo = ALGO_SCRYPT;
@ -144,11 +145,11 @@ struct work_restart *work_restart = NULL;
static struct stratum_ctx stratum; static struct stratum_ctx stratum;
pthread_mutex_t applog_lock; pthread_mutex_t applog_lock;
pthread_mutex_t stats_lock; static pthread_mutex_t stats_lock;
static unsigned long accepted_count = 0L; static unsigned long accepted_count = 0L;
static unsigned long rejected_count = 0L; static unsigned long rejected_count = 0L;
double *thr_hashrates; static double *thr_hashrates;
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
#include <getopt.h> #include <getopt.h>
@ -1244,7 +1245,7 @@ static void parse_cmdline(int argc, char *argv[])
} }
#ifndef WIN32 #ifndef WIN32
void signal_handler(int sig) static void signal_handler(int sig)
{ {
switch (sig) { switch (sig) {
case SIGHUP: case SIGHUP: