commit d32f875e3b778a67d96c666da16c97a4db29cb88
parent eb74cfc05526d43522d15edc64a7d77048099a6d
Author: Hans Petter Selasky <hps@selasky.org>
Date: Sun, 23 Nov 2014 19:55:15 +0100
The SYS_gettid system call does not exist in FreeBSD.
Use pthread_self() instead.
Signed-off-by: Hans Petter Selasky <hps@selasky.org>
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp
@@ -23,19 +23,20 @@
#include "OscilGen.h"
#include "../Misc/WaveShapeSmps.h"
-int main_thread = 0;
#include <cassert>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stddef.h>
+#include <pthread.h>
#include <unistd.h>
-#include <sys/syscall.h>
#include <rtosc/ports.h>
#include <rtosc/port-sugar.h>
+pthread_t main_thread;
+
#define PC(x) rParamZyn(P##x, "undocumented oscilgen parameter")
#define rObject OscilGen
@@ -152,9 +153,9 @@ static rtosc::Ports localPorts = {
assert(rtosc_argument(m,0).b.len == sizeof(void*));
d.reply("/free", "sb", "fft_t", sizeof(void*), &o.oscilFFTfreqs);
//fprintf(stderr, "\n\n");
- //fprintf(stderr, "The ID of this of this thread is: %ld\n", (long int)syscall(SYS_gettid));
+ //fprintf(stderr, "The ID of this of this thread is: %ld\n", (long)pthread_self());
//fprintf(stderr, "o.oscilFFTfreqs = %p\n", o.oscilFFTfreqs);
- assert(main_thread != syscall(SYS_gettid));
+ assert(main_thread != pthread_self());
assert(o.oscilFFTfreqs !=*(fft_t**)rtosc_argument(m,0).b.data);
o.oscilFFTfreqs = *(fft_t**)rtosc_argument(m,0).b.data;
}},
diff --git a/src/main.cpp b/src/main.cpp
@@ -31,7 +31,6 @@
#include <unistd.h>
#include <pthread.h>
-#include <sys/syscall.h>
#include <getopt.h>
@@ -81,7 +80,7 @@ char *instance_name = 0;
void exitprogram();
-extern int main_thread;
+extern pthread_t main_thread;
//cleanup on signaled exit
void sigterm_exit(int /*sig*/)
@@ -138,7 +137,7 @@ void exitprogram()
int main(int argc, char *argv[])
{
- main_thread = (long int)syscall(SYS_gettid);
+ main_thread = pthread_self();
synth = new SYNTH_T;
config.init();
dump.startnow();