31 #include "CLAM_windows.h"
35 typedef void *(*pthread_start_pfunc) (
void *);
63 res = SetPriorityClass(GetCurrentProcess(),NORMAL_PRIORITY_CLASS );
65 res = SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_NORMAL );
70 struct sched_param sched_param;
73 if (pthread_getschedparam(pthread_self(), &policy, &sched_param) < 0) {
74 printf(
"Scheduler getparam failed...\n");
76 sched_param.sched_priority = sched_get_priority_max(SCHED_RR)-1;
77 if (!pthread_setschedparam(pthread_self(), SCHED_RR, &sched_param)) {
78 printf(
"Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority);
81 struct sched_param sched_param;
84 if (pthread_getschedparam(pthread_self(), &policy, &sched_param) < 0) {
85 printf(
"Scheduler getparam failed...\n");
87 sched_param.sched_priority = sched_get_priority_max(policy)/2;
88 pthread_setschedparam(pthread_self(), policy, &sched_param);
103 LaunchThreadCleanup(
this);
114 CLAM_ASSERT( ret == 0,
"The thread cannot yield?!!" );
129 void* Thread::LaunchThread(
void* pvoid )
142 void Thread::LaunchThreadCleanup(
void* pvoid )
145 if ( pSelf->mHasCleanup )
148 pthread_join( pSelf->mThreadID,
NULL );
153 SleepDetail( milliseconds );
158 SleepDetail( 31536000 );
161 void Thread::SleepDetail(
unsigned int milliseconds)