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.

Signed-off-by: Gowrishankar <[email protected]>
Tested-by: Gowrishankar <[email protected]>
Acked-by: Will Schmidt <[email protected]>
Acked-by: Darren Hart <[email protected]>
---
 testcases/realtime/lib/librttest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/realtime/lib/librttest.c 
b/testcases/realtime/lib/librttest.c
index e092f35..49fec29 100644
--- a/testcases/realtime/lib/librttest.c
+++ b/testcases/realtime/lib/librttest.c
@@ -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));
-- 
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

Reply via email to