1757932 Members
2869 Online
108866 Solutions
New Discussion юеВ

pthread_create

 

pthread_create

Hi All,

My application fails because pthread_create is failing with a return value 22.

Can any one help me for same...

Thanks in Advance.

Regards,
Subrat

4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: pthread_create

Have you linked with -lpthread? And made sure there are NO -lc on the driver link line?
AwadheshPandey
Honored Contributor

Re: pthread_create

calls to shl_load(3x) fail with errno 22 (invalid argument) because the pthread_mutex_lock stub returns zero
http://docs.hp.com/en/1896/pthreads.html
It's kind of fun to do the impossible

Re: pthread_create

Hi Dennis,

I am using -lpthread and not -lc for link.
my appliction is not stop in first time.some time after error is comming and its stop.


Hi Awadhes,

I can't understand what you said exectly about pthread_mutex_lock stub returns zero .
Please explain.

Thanks

Regards,
Subrat
Dennis Handly
Acclaimed Contributor

Re: pthread_create

>I am using -lpthread and not -lc for link.

You need to make sure that none of the shlibs you use are linked with -lc either. Try ldd on your application.

>I can't understand what you said exactly about pthread_mutex_lock stub returns zero.

He means if you have your shlibs in the wrong order, you're hosed. See the link Awadhesh mentions.

Hmm, this may be all wrong. That errno 22 is related to shl_load.

If you are calling pthead_create and you have the wrong order, you get ENOSYS, 251.

Basically you get 22, EINVAL, by:
invalid thread attributes
The value specified by thread is invalid.
The scheduling policy or scheduling attributes

You need to look at your parms closely. Try replacing your attributes by NULL and check again.