23 #include <mach/thread_policy.h> 24 #include <mach/mach.h> 105 UERROR(
"Thread cannot join itself");
141 UERROR(
"Failed to create a thread! errno=%d", r);
167 int p = THREAD_PRIORITY_NORMAL;
171 p = THREAD_PRIORITY_LOWEST;
175 p = THREAD_PRIORITY_BELOW_NORMAL;
179 p = THREAD_PRIORITY_NORMAL;
183 p = THREAD_PRIORITY_ABOVE_NORMAL;
187 p = THREAD_PRIORITY_TIME_CRITICAL;
214 thread_affinity_policy_data_t affPolicy;
216 kern_return_t ret = thread_policy_set(
218 THREAD_AFFINITY_POLICY,
219 (integer_t*) &affPolicy,
220 THREAD_AFFINITY_POLICY_COUNT);
221 if(ret != KERN_SUCCESS)
223 UERROR(
"thread_policy_set returned %d", ret);
virtual void mainLoop()=0
static int Create(const Handler &Function, Thread_C_R Param, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false)
UThread(Priority priority=kPNormal)
void setAffinity(int cpu=0)
#define ULOGGER_DEBUG(...)
virtual void mainLoopBegin()
virtual void mainLoopKill()
void setPriority(Priority priority)
virtual void mainLoopEnd()
void uSleep(unsigned int ms)
ULogger class and convenient macros.
void join(bool killFirst=false)