Skip to contentSkip to conversation

realtime: rearrange the pthread attr functions order in librttest

PATCH In review Gowrishankar 2 participants 2 messages Jun 29, 2010 – Jul 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 realtime: rearrange the pthread attr functions order in librttest

From: gowrishankar <[email protected]>

In the recent pthread libraries, order of calling pthread_attr_setschedpolicy and pthread_attr_setschedparam plays important role in a way that, former should always be called followed by later.

Otherwise, pthread_attr_setschedparam always ends with error 22 (EINVAL). This patch fixes the create_thread() in librttest library.

---
 testcases/realtime/lib/librttest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/realtime/lib/librttest.c +1 -1
index e092f35..49fec29 100644
@@ -295,8 +295,8 @@ int create_thread(void*(*func)(void*), void *arg, int prio, int policy)
 
 	pthread_attr_init(&thread->attr);
 	pthread_attr_setinheritsched(&thread->attr, PTHREAD_EXPLICIT_SCHED);
-	pthread_attr_setschedparam(&thread->attr, &param);
 	pthread_attr_setschedpolicy(&thread->attr, thread->policy);
+	pthread_attr_setschedparam(&thread->attr, &param);
 
 	if ((ret = pthread_create(&thread->pthread, &thread->attr, func, (void*)thread))) {
 		printf("pthread_create failed: %d (%s)\n", ret, strerror(ret));
Signature · 11 lines
1.7.1


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 10 lines · Gowrishankar

From: gowrishankar <[email protected]>

In the recent pthread libraries, order of calling pthread_attr_setschedpolicy and pthread_attr_setschedparam plays important role in a way that, former should always be called followed by later.

Otherwise, pthread_attr_setschedparam always ends with error 22 (EINVAL). This patch fixes the create_thread() in librttest library.

Thanks.

Regards--
Subrata

Quoted 12 lines
---
 testcases/realtime/lib/librttest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/realtime/lib/librttest.c +0 -0
index e092f35..49fec29 100644

testcases/realtime/lib/librttest.c int create_thread(void*(*func)(void*), void *arg, int prio, int policy) · line 302

Quoted 9 lines
testcases/realtime/lib/librttest.c +1 -1
@@ -295,8 +295,8 @@ int create_thread(void*(*func)(void*), void *arg, int prio, int policy)
 
 	pthread_attr_init(&thread->attr);
 	pthread_attr_setinheritsched(&thread->attr, PTHREAD_EXPLICIT_SCHED);
-	pthread_attr_setschedparam(&thread->attr, &param);
 	pthread_attr_setschedpolicy(&thread->attr, thread->policy);
+	pthread_attr_setschedparam(&thread->attr, &param);
 
 	if ((ret = pthread_create(&thread->pthread, &thread->attr, func, (void*)thread))) {
 		printf("pthread_create failed: %d (%s)\n", ret, strerror(ret));

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list