anonymous contribution for improved Chromakey plugin to include sliders, textbox...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / thread.C
index 50b52a47cc52069f5becc3c37d189757884aaee1..edac145110e8e8d978d203656b80a8c0bf2847f7 100644 (file)
@@ -28,6 +28,9 @@
 #include <string.h>
 #include <typeinfo>
 #include "thread.h"
+#if defined(__TERMUX__)
+#include "bthread.h"
+#endif
 
 
 Thread::Thread(int synchronous, int realtime, int autodelete)
@@ -55,13 +58,15 @@ void* Thread::entrypoint(void *parameters)
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
        thread->cancel_enabled = false;
 
+// not on bsd
+#if defined (__linux__) || defined (__TERMUX__)
 // Set realtime here since it doesn't work in start
        if( thread->realtime && getuid() == 0 ) {
                struct sched_param param = { sched_priority : 1 };
                if(pthread_setschedparam(thread->tid, SCHED_RR, &param) < 0)
                        perror("Thread::entrypoint pthread_attr_setschedpolicy");
        }
-
+#endif
        thread->run();
        thread->finished = true;
        if( !thread->synchronous ) {
@@ -102,8 +107,10 @@ void Thread::start()
                        perror("Thread::start pthread_attr_setschedparam");
        }
        else {
+#if !defined(__TERMUX__)
                if(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED) < 0)
                        perror("Thread::start pthread_attr_setinheritsched");
+#endif
        }
 
 // autodelete may delete this immediately after create