Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-22-2005, 01:00 PM   #1
LQ Newbie
Registered: Jun 2005
Posts: 3

Rep: Reputation: 0
thread priority


I have been trying to start a thread with a high priority. When I do set it to a higher priority then the thread doesn't seem to execute. When I just run the thread with out passing it an attribute it works just fine.

Here is my code:

pthread_attr_t attr;
sched_param schedparam;
schedparam.sched_priority = 2;
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setschedparam(&attr, &schedparam);

dasToTape->Start(NULL, &attr);
And here is the start function where I start the thread.

bool CWorkerThread::Start(void *pArg, pthread_attr_t *threadAttr)
        int rc;
        pthread_t thread;
        m_UserData= pArg;
        m_Shutdown= false;
        rc= pthread_create(&thread, threadAttr,  m_pThreadFunc, this);
                cout << "thread creation failed" <<endl;
        return 1;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[thread control suggestion] add a "solved" button that the thread starter can click atom LQ Suggestions & Feedback 3 03-24-2005 11:55 AM
Main thread sending notification to child thread rajesh_b Programming 1 09-22-2004 09:15 AM
'Last Thread' 'Next Thread' for 0 Replies and new posts darin3200 LQ Suggestions & Feedback 2 08-16-2004 01:02 PM
configure qt thread issue (just compiled qt w/ -thread option) cleff Linux - Software 8 05-07-2004 11:11 PM
send parameter from thread to thread marek Programming 2 09-08-2003 05:33 AM

All times are GMT -5. The time now is 01:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration