Unix Technical Forum

pthread_create fails when used with pthread_attr_setinheritsched() on HPUX

This is a discussion on pthread_create fails when used with pthread_attr_setinheritsched() on HPUX within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> I am using HPUX on Itanium and I have c program where I am doing something like this but ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 05:47 AM
abhijeet.bhattacharya@gmail.com
 
Posts: n/a
Default pthread_create fails when used with pthread_attr_setinheritsched() on HPUX

I am using HPUX on Itanium and I have c program where I am doing
something like this
but this pthread_create always fails at runtime
prio = PRI_MAX;
prio_low = PRI_MIN;
..
..
..
..
struct sched_param sched_param={1};
sched_param.sched_priority=prio;
thret = pthread_attr_setschedparam(&serv_attr, &sched_param);

thret =
pthread_attr_setinheritsched(&serv_attr,PTHREAD_EX PLICIT_SCHED);

..
..
..
thret = pthread_create(&sthread,&serv_attr,server_main, 0);

but if i remove this line

thret =
pthread_attr_setinheritsched(&serv_attr,PTHREAD_EX PLICIT_SCHED);

it works fine, can anyone suggest whats happening here. I have tried
the same on AIX and Solaris, it works there.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 05:47 AM
Rick Jones
 
Posts: n/a
Default Re: pthread_create fails when used with pthread_attr_setinheritsched() on HPUX

abhijeet.bhattacharya@gmail.com wrote:
> I am using HPUX on Itanium and I have c program where I am doing
> something like this
> but this pthread_create always fails at runtime
> prio = PRI_MAX;
> prio_low = PRI_MIN;
> .
> .
> .
> .
> struct sched_param sched_param={1};
> sched_param.sched_priority=prio;
> thret = pthread_attr_setschedparam(&serv_attr, &sched_param);


> thret =
> pthread_attr_setinheritsched(&serv_attr,PTHREAD_EX PLICIT_SCHED);
> .
> .
> .
> thret = pthread_create(&sthread,&serv_attr,server_main, 0);


> but if i remove this line
> thret =
> pthread_attr_setinheritsched(&serv_attr,PTHREAD_EX PLICIT_SCHED);


> it works fine, can anyone suggest whats happening here. I have tried
> the same on AIX and Solaris, it works there.


Are you checking the return status on the call to make sure it
succeded? If it failed, perhaps the serv_attr isn't in a usable state
and that triggers the pthread_create failure. What is the specific
error return from pthread_create?

I know it is a tired, old song and dance, but have you checked the
various manpages on HP-UX for those calls?

rick jones
--
denial, anger, bargaining, depression, acceptance, rebirth...
where do you want to be today?
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 05:48 AM
Tammy L Morford
 
Posts: n/a
Default Re: pthread_create fails when used with pthread_attr_setinheritsched() on HPUX

abhijeet wrote:
: I am using HPUX on Itanium and I have C program where I am doing
: something like this but this pthread_create always fails at runtime
: struct sched_param sched_param={1};

This was also submitted on the ITRC:
http://forums1.itrc.hp.com/service/f...readId=1090167

I tracked this down to the value 1. It has to be in the range:
Min pri: -256, max pri: -129

And only by root.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:52 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com