How do I set the priority of a thread in QNX???? plz help..

Hello,

I want to set the priority of a process in qnx. I found it hard to do
this just by following the help files, so i have copy/pasted bits of
code from several messages. According to these messages this code i
have contructed should work. It doesnt seem to do so however. Could
anyone please review my code and give some comments? Any help would be
appreciated.

my code:

int main( void )
{

int thid = ThreadCreate( 0,playerstart,“jaap.mp3” , NULL );

struct sched_param schedParam;
pthread_attr_t attr;

pthread_attr_init(&attr);

schedParam.sched_priority = 63;/this should be the highest priority
right??!
/
pthread_setschedparam(thid, SCHED_FIFO, &schedParam);
pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);/this
line was
needed according to
one of the notes
/


/* Allow threads to run for 60 seconds. */
sleep( 60 );
return EXIT_SUCCESS;
}

Thanks a LOT!

Bart.

You want to look at pthread_create() and not ThreadCreate(). The
pthread_create() will take the attributes you want and set the
priority of the thread.

chris


Bart <b_van_gils@hotmail.com> wrote:

Hello,

I want to set the priority of a process in qnx. I found it hard to do
this just by following the help files, so i have copy/pasted bits of
code from several messages. According to these messages this code i
have contructed should work. It doesnt seem to do so however. Could
anyone please review my code and give some comments? Any help would be
appreciated.

my code:

int main( void )
{

int thid = ThreadCreate( 0,playerstart,“jaap.mp3” , NULL );

struct sched_param schedParam;
pthread_attr_t attr;

pthread_attr_init(&attr);

schedParam.sched_priority = 63;/this should be the highest priority
right??!
/
pthread_setschedparam(thid, SCHED_FIFO, &schedParam);
pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);/this
line was
needed according to
one of the notes
/


/* Allow threads to run for 60 seconds. */
sleep( 60 );
return EXIT_SUCCESS;
}

Thanks a LOT!

Bart.

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<