39 namespace rp{
namespace hal{
43 Thread newborn(proc, data);
46 assert(
sizeof(newborn.
_handle) >=
sizeof(pthread_t));
48 pthread_create((pthread_t *)&newborn.
_handle, NULL, (
void * (*)(
void *))proc, data);
67 struct sched_param current_param;
69 if (pthread_getschedparam( (pthread_t) this->
_handle, ¤t_policy, ¤t_param))
81 current_policy = SCHED_RR;
85 current_policy = SCHED_RR;
91 current_policy = SCHED_OTHER;
95 current_param.__sched_priority = current_policy;
96 if ( (ans = pthread_setschedparam( (pthread_t) this->_handle, current_policy, ¤t_param)) )
108 struct sched_param current_param;
109 if (pthread_getschedparam( (pthread_t) this->
_handle, ¤t_policy, ¤t_param))
115 int pthread_priority_max = sched_get_priority_max(SCHED_RR);
116 int pthread_priority_min = sched_get_priority_min(SCHED_RR);
118 if (current_param.__sched_priority ==(pthread_priority_max ))
122 if (current_param.__sched_priority >=(pthread_priority_max + pthread_priority_min)/2)
133 pthread_join((pthread_t)(this->
_handle), NULL);
u_result join(unsigned long timeout=-1)
static Thread create(thread_proc_t proc, void *data=NULL)
priority_val_t getPriority()
#define RESULT_OPERATION_FAIL
u_result setPriority(priority_val_t p)