Commit 0e82c5b4 authored by Daan Vreeken's avatar Daan Vreeken
Browse files

Committer: Daan Vreeken <pa4dan@RacebeestV3.VEHosting.LAN>

	modified:   controller/controller/controller_sample.c

o Disable cpu_bind() on FreeBSD. The interface is different on FreeBSD. Leave
  implementing it for a future visitor to this file.
o Switch to CLOCK_MONOTONIC on FreeBSD. My test system doesn't implement
o DOn't set the stack size of new threads to PTHREAD_STACK_MIN on FreeBSD.
  Things will explode otherwise.
parent fb6535e4
......@@ -148,6 +148,7 @@ static void alarm_handler(int d)
static void cpu_bind(void)
#ifndef __FreeBSD__
unsigned int cpus = 2;
cpu_set_t set_sample, set_others;
int r, n;
......@@ -218,6 +219,7 @@ static void cpu_bind(void)
log_send(LOG_T_DEBUG, "Set CPU affinity for %d PIDs, %d failed",
nr_set, nr_failed);
static uint64_t timestamp_from_timespec(struct timespec *t)
......@@ -254,7 +256,7 @@ static void wait_init_default(struct timespec *t)
#ifndef __FreeBSD__
sample_clock = CLOCK_REALTIME;
sample_clock = CLOCK_MONOTONIC;
pthread_condattr_setclock(&attr, sample_clock);
pthread_cond_init(&cv, &attr);
......@@ -540,7 +542,9 @@ int controller_sample_start(void)
#ifndef __FreeBSD__
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
pthread_create(&thread_id, &attr, sample_monitor, NULL);
pthread_create(&controller_sample_thread, &attr, sample_thread, NULL);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment