From: gowrishankar <[email protected]>

Since main() sets the cpu affinity, it is not necessary for the
spawned threads to do so, as the threads inherit the cpu affinity.

Signed-off-by: Gowrishankar <[email protected]>
Tested-by: Gowrishankar <[email protected]>
Acked-by: Darren Hart <[email protected]>
---
 testcases/realtime/func/pi-tests/testpi-4.c |   36 ++------------------------
 1 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/testcases/realtime/func/pi-tests/testpi-4.c 
b/testcases/realtime/func/pi-tests/testpi-4.c
index 6a90771..0960c91 100644
--- a/testcases/realtime/func/pi-tests/testpi-4.c
+++ b/testcases/realtime/func/pi-tests/testpi-4.c
@@ -81,17 +81,7 @@ pthread_mutex_t *glob_mutex;
 void *func_nonrt(void *arg)
 {
        struct thread *pthr = (struct thread *)arg;
-       int rc, i, j, tid = gettid();
-       cpu_set_t mask;
-       CPU_ZERO(&mask);
-       CPU_SET(0, &mask);
-
-       rc = sched_setaffinity(0, sizeof(mask), &mask);
-       if (rc < 0) {
-               printf("Thread %d: Can't set affinity: %d %s\n",
-                       tid, rc, strerror(rc));
-               exit(-1);
-       }
+       int i, j, tid = gettid();
 
        printf("Thread %d started running with priority %d\n", tid,
                pthr->priority);
@@ -119,17 +109,7 @@ void *func_nonrt(void *arg)
 void *func_rt(void *arg)
 {
        struct thread *pthr = (struct thread *)arg;
-       int rc, i, j, tid = gettid();
-       cpu_set_t mask;
-       CPU_ZERO(&mask);
-       CPU_SET(0, &mask);
-
-       rc = sched_setaffinity(0, sizeof(mask), &mask);
-       if (rc < 0) {
-               printf("Thread %d: Can't set affinity: %d %s\n",
-                       tid, rc, strerror(rc));
-               exit(-1);
-       }
+       int i, j, tid = gettid();
 
        printf("Thread %d started running with prio %d\n", tid,
                pthr->priority);
@@ -162,17 +142,7 @@ void *func_rt(void *arg)
 void *func_noise(void *arg)
 {
        struct thread *pthr = (struct thread *)arg;
-       int rc, i, j, tid = gettid();
-       cpu_set_t mask;
-       CPU_ZERO(&mask);
-       CPU_SET(0, &mask);
-
-       rc = sched_setaffinity(0, sizeof(mask), &mask);
-       if (rc < 0) {
-               printf("Thread %d: Can't set affinity: %d %s\n", tid, rc,
-                       strerror(rc));
-               exit(-1);
-       }
+       int i, j, tid = gettid();
 
        printf("Noise Thread started running with prio %d\n",
                pthr->priority);
-- 
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