pthread question

N

nothing

Hi,

I'm having troubles setting the priority of a p thread.
I get a segmentation fault when i do following:
Code:
pthread_t *ss_tid;                              //declaration
ss_tid  = (pthread_t*)malloc(sizeof(pthread_t));//do the memory allocation
struct sched_param   param;                     //declaration
memset(&param, 0, sizeof(param));               //allocation
pthread_setschedparam(*ss_tid, SCHED_RR, &param); // HERE I GET
SEGMENTATIONFAULT
I'm not understanding, shouldn't this work just fine?
What am I doing wrong?

Thank you!
Ron
 
R

red floyd

Hi,

I'm having troubles setting the priority of a p thread.
I get a segmentation fault when i do following:
Code:
pthread_t *ss_tid;                              //declaration
ss_tid  = (pthread_t*)malloc(sizeof(pthread_t));//do the memory allocation
struct sched_param   param;                     //declaration
memset(&param, 0, sizeof(param));               //allocation
pthread_setschedparam(*ss_tid, SCHED_RR, &param); // HERE I GET
SEGMENTATIONFAULT
I'm not understanding, shouldn't this work just fine?
What am I doing wrong?

You're asking in the wrong group, this is not a C++ language question.
Try a unix or threading group.

However, the value stored in ss_tid is undefined (you malloc it, but
never set it to anything).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,175
Messages
2,570,945
Members
47,493
Latest member
SelenaHoin

Latest Threads

Top