38     typedef int         ut_thread_id_t;
 
   39 #elif defined(USE_PTHREADS) 
   42     typedef pthread_t   ut_thread_id_t;
 
   44     #error Unsupported Platform for UT_Thread 
   47 #define UT_INVALID_THREAD_ID ((ut_thread_id_t)0) 
   50 #define UT_THREAD_DEFAULT_STACK_SIZE    (8U*1024U*1024U) 
   51 #define UT_THREAD_SMALL_STACK_SIZE      (1U*1024U*1024U) 
   53 typedef void *(*UTthreadFunc)(
void*);
 
   94     static UT_Thread    *allocThread(SpinMode spin_mode);
 
   96     static int           getNumProcessors();
 
   99     static int           activeThreadCount();
 
  105     static void          resetNumProcessors();
 
  108 #if defined(USE_PTHREADS) 
  109     static ut_thread_id_t getMyThreadId() { 
return pthread_self(); }
 
  111     static ut_thread_id_t getMyThreadId();
 
  114     static ut_thread_id_t getMainThreadId();
 
  115     static int            getMainSequentialThreadId();
 
  118                              return getMyThreadId() == getMainThreadId();
 
  124     static bool           isUTThreadCurrent();
 
  131     static bool           isThreadingEnabled();
 
  137     static bool           setThreadingEnabled(
bool will_be_enabled);
 
  143             : myPreviouslyEnabled(setThreadingEnabled(false))
 
  147             if (myPreviouslyEnabled)
 
  148                 setThreadingEnabled(
true);
 
  151         const bool myPreviouslyEnabled;
 
  157                               for(
uint i = 0; i < cycles; i++)
 
  158 #
if defined(USE_PTHREADS)
 
  160                                   __asm__ __volatile__(
"yield;");
 
  162                                   __asm__ __volatile__(
"pause;");
 
  169 #if defined(USE_PTHREADS) 
  170     static inline void    yield(
bool higher_only=
false)
 
  181                                   struct timespec ts = {0,100};
 
  186     static void         yield(
bool higher_only=
false);
 
  202     static void          configureMaxThreads(
int maxthreads = 0);
 
  209     static void          configureThreadStackSize(
int stacksize);
 
  215     static bool          minimizeThisThreadPriority();
 
  223     void                 setQoS(qos_class_t qos);
 
  228     qos_class_t          getQoS() 
const;
 
  252     virtual void         threadStarted();
 
  256     virtual void         threadEnded();
 
  264     virtual int          isResourceHog() 
const;
 
  267     virtual State        getState();
 
  269     virtual void         waitForState(
State desired) = 0;
 
  270     virtual void         setSpinMode(
SpinMode spin_mode);
 
  273     virtual void         killThread() = 0;
 
  277     virtual int          suspendThread() = 0;
 
  278     virtual int          restartThread() = 0;
 
  281                          { 
return waitThread(0); }
 
  284     virtual int64        getMemoryUsage(
bool inclusive) 
const = 0;
 
  291     virtual int          waitThread(
int block=1) = 0;
 
  294     virtual int          isValid();
 
  299     static void         *threadWrapper(
void *
data);
 
  321     static void onExit_();
 
  336                                      int stacksize) 
override;
 
  346         int64 mem = inclusive ? 
sizeof(*this) : 0;
 
  360      UT_ThreadSet(
int nthreads=-1, 
int null_thread_if_1_cpu = 0);
 
  372                     myUserData = user_data_array;
 
  373                     myUserDataInc = structlen;
 
  377                     myUserData = user_data;
 
  383     int         wait(
int block=1);
 
  390                              return myThreads[which];
 
  431     UT_Thread   *nextThread(
int *thread_index =0,
 
  432                             AssignmentStyle style = BLOCKING);
 
  436     int          wait(
int block = 1);
 
  446                      return myThreads[
index];
 
  450     void         addThreads(
int thread_count);
 
  462     static const uint   cycles_for_noop = 4;
 
  463     static const uint   cycles_for_pause = cycles_for_noop * 4;
 
  464     static const uint   cycles_for_yield_higher = cycles_for_pause * 2;
 
  465     static const uint   cycles_for_yield_all = cycles_for_yield_higher * 2;
 
  470         if (myCycles > cycles_for_yield_all)
 
  477         if (myCycles <= cycles_for_noop)
 
  481         else if (myCycles <= cycles_for_pause)
 
  485         else if (myCycles <= cycles_for_yield_higher)
 
  489         myCycles += (myCycles+1)>>1;
 
  522     template <
typename Func, 
typename... Args>
 
  525                   WrapFunctor<Func, Args...>(std::forward<Func>(
func)),
 
  526                   std::forward<Args>(
args)...)
 
  536     template <
typename Func, 
typename... Args>
 
  540         WrapFunctor(Func&& 
func)
 
  541             : myFunc(std::move(
func))
 
  545         decltype(
auto) operator()(Args&&... 
args)
 const 
  548             return myFunc(std::forward<Args>(args)...);
 
  565         myThreads.setSize(nthreads);
 
  573         return myThreads(idx);
 
  577         return myThreads(idx);
 
  581         return myThreads[idx];
 
  585         return myThreads[idx];
 
  589         for (
auto&& 
t : myThreads)
 
  602         for (
auto&& 
t : myThreads)
 
int getNumThreads() const 
 
void setUserData(void *user_data)
 
#define SYS_DEPRECATED(__V__)
 
int64 getMemoryUsage(bool inclusive) const override
NOTE: This level doesn't own any data apart from itself. 
 
The subsystem to initialize and cleanup UT. 
 
virtual int restartThread()=0
 
void *(* UTthreadFunc)(void *)
 
UT_StdThread(Func &&func, Args &&...args)
 
UT_Thread * operator[](int index)
 
bool joinable(int idx) const 
 
UT_StdThread & operator=(const UT_StdThread &)=delete
 
UT_Thread * operator[](int which)
 
thread_t & operator[](int idx)
 
virtual void setState(State state)=0
 
UT_StdThreadGroup & operator=(const UT_StdThreadGroup &)=delete
 
static int getNumProcessors()
 
virtual void waitForState(State desired)=0
 
void setFunc(UTthreadFunc func)
 
virtual bool startThread(UTthreadFunc func, void *data, int stacksize)=0
 
UT_Thread & operator=(const UT_Thread &)=delete
 
virtual void killThread()=0
 
const UT_TaskScope * myTaskScope
 
const thread_t & operator[](int idx) const 
 
FS_API bool cleanup(UT_StringArray &removed, UT_StringArray &error_files, exint &memory_freed, bool dry_run, const char *override_path=nullptr)
 
virtual int suspendThread()=0
 
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
 
static int isMainThread()
 
~ThreadingDisabledScope()
 
LeafData & operator=(const LeafData &)=delete
 
static void pause(uint cycles)
 
**If you just want to fire and args
 
static void yield(bool higher_only=false)
 
virtual int waitThread(int block=1)=0
 
void setUserData(void *user_data_array, size_t structlen)
 
UT_StdThreadGroup(int nthreads=-1)