no difference seen even after setting application thread priority in linux environmen
Hi,
Can any one help in resolving the below problem.
Actually i am trying to set different priorities for two application threads.With root privilages i could set the thread priority using pthread_setschedparam()(Returning the expected as successfull) in linux environment.But i don't see any difference in the output(thread's) i.e.thread with high priority and thread with low priority are exiting at the same time. Actually thread with high priority should get called more number of times and it should exit first.
Below is the process i followed to set the thread priority.
pthread_attr_t attr;
pthread_t threadId;
int threadStatus;
struct sched_param param;
int policy;
threadStatus = pthread_attr_init(&attr);
threadStatus = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
threadStatus = pthread_attr_setstacksize(&attr,0x10000);
param.sched_priority = threadPriority;
ret = pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED);
/* cleanup any zombie threads that are holding resources */
waitpid(0, &status, WNOHANG | __WCLONE);
threadStatus = pthread_create(&threadId, &attr, pThreadFuncAddress, pParameter);
ret= pthread_setschedparam(threadId,SCHED_RR,¶m);
Please comment..
|