* [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling
@ 2013-10-03 11:32 Jan Stancek
2013-10-03 11:32 ` [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup Jan Stancek
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jan Stancek @ 2013-10-03 11:32 UTC (permalink / raw)
To: ltp-list
Remove all gotos and if there's error in any of pthread
functions exit immediately.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../interfaces/pthread_attr_setschedpolicy/2-1.c | 105 +++++++-------------
1 files changed, 34 insertions(+), 71 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
index 6088466..6c471d6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <pthread.h>
#include <unistd.h>
+#include <stdlib.h>
#include <errno.h>
#include <posixtest.h>
@@ -40,8 +41,10 @@ static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static int thread_started;
-#define ERR_MSG(f, rc) printf("Failed: function: %s status: %s(%u)\n", \
- f, strerror(rc), rc)
+#define FAIL_AND_EXIT(f, rc) { \
+ printf("Failed: function: %s status: %s(%u)\n", f, strerror(rc), rc); \
+ exit(PTS_UNRESOLVED); \
+}
static void *thread_func(void *data)
{
@@ -50,23 +53,17 @@ static void *thread_func(void *data)
int rc;
rc = pthread_getschedparam(pthread_self(), &policy, &sp);
- if (rc) {
- ERR_MSG("pthread_getschedparam()", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_getschedparam()", rc);
thread_started = 1;
rc = pthread_cond_signal(&cond);
- if (rc) {
- ERR_MSG("pthread_cond_signal()", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_cond_signal()", rc);
rc = pthread_mutex_lock(&mutex);
- if (rc) {
- ERR_MSG("pthread_mutex_lock()", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_lock()", rc);
/* Stuff the priority in execution order */
if (!priorities[0])
@@ -77,79 +74,58 @@ static void *thread_func(void *data)
priorities[2] = sp.sched_priority;
rc = pthread_mutex_unlock(&mutex);
- if (rc) {
- ERR_MSG("pthread_mutex_unlock()", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
-done:
return (void *)(long)rc;
}
static int create_thread(int prio, pthread_t * tid)
{
int rc;
- char *func;
struct sched_param sp;
pthread_attr_t attr;
- func = "pthread_attr_init()";
rc = pthread_attr_init(&attr);
if (rc != 0)
- goto done;
+ FAIL_AND_EXIT("pthread_attr_init()", rc);
- func = "pthread_attr_setschedpolicy()";
rc = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
if (rc != 0)
- goto error;
+ FAIL_AND_EXIT("pthread_attr_setschedpolicy()", rc);
- func = "pthread_attr_setinheritsched()";
rc = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
if (rc != 0)
- goto error;
+ FAIL_AND_EXIT("pthread_attr_setinheritsched()", rc);
- func = "pthread_attr_setschedparam()";
sp.sched_priority = prio;
rc = pthread_attr_setschedparam(&attr, &sp);
if (rc != 0)
- goto error;
+ FAIL_AND_EXIT("pthread_attr_setschedparam()", rc);
thread_started = 0;
rc = pthread_create(tid, &attr, thread_func, NULL);
- if (rc) {
- ERR_MSG("pthread_create()", rc);
- goto error;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_create()", rc);
while (!thread_started) {
- func = "pthread_mutex_lock()";
rc = pthread_mutex_lock(&c_mutex);
if (rc)
- goto error;
+ FAIL_AND_EXIT("pthread_mutex_lock()", rc);
- func = "pthread_cond_wait()";
rc = pthread_cond_wait(&cond, &c_mutex);
if (rc)
- goto unlock;
+ FAIL_AND_EXIT("pthread_cond_wait()", rc);
- func = "pthread_mutex_unlock()";
rc = pthread_mutex_unlock(&c_mutex);
if (rc)
- goto error;
+ FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
}
pthread_attr_destroy(&attr);
return 0;
-
-unlock:
- (void)pthread_mutex_unlock(&c_mutex);
-error:
- pthread_attr_destroy(&attr);
-done:
- ERR_MSG(func, rc);
- return -1;
}
int main(void)
@@ -166,48 +142,36 @@ int main(void)
status = PTS_UNRESOLVED;
rc = pthread_mutex_lock(&mutex);
- if (rc) {
- ERR_MSG("pthread_mutex_lock()", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_lock()", rc);
rc = create_thread(PRIO_LOW, &t3);
if (rc)
- goto done;
+ FAIL_AND_EXIT("create_thread LOW", rc);
rc = create_thread(PRIO_MED, &t2);
if (rc)
- goto done;
+ FAIL_AND_EXIT("create_thread MED", rc);
rc = create_thread(PRIO_HIGH, &t1);
if (rc)
- goto done;
+ FAIL_AND_EXIT("create_thread HIGH", rc);
rc = pthread_mutex_unlock(&mutex);
if (rc)
- ERR_MSG("pthread_mutex_unlock()", rc);
+ FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
rc = pthread_join(t1, &r1);
- if (rc) {
- ERR_MSG("pthread_join(t1)", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_join(t1)", rc);
rc = pthread_join(t2, &r2);
- if (rc) {
- ERR_MSG("pthread_join(t2)", rc);
- goto done;
- }
+ if (rc)
+ FAIL_AND_EXIT("pthread_join(t2)", rc);
rc = pthread_join(t3, &r3);
- if (rc) {
- ERR_MSG("pthread_join(t3)", rc);
- goto done;
- }
-
- /* Threads fail? */
- if ((long)r1 || (long)r2 || (long)r2)
- goto done;
+ if (rc)
+ FAIL_AND_EXIT("pthread_join(t3)", rc);
/* priorities must be high to low */
status = PTS_FAIL;
@@ -223,7 +187,6 @@ int main(void)
else
status = PTS_PASS;
-done:
if (status == PTS_PASS)
printf("Test PASSED\n");
--
1.7.1
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread* [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup
2013-10-03 11:32 [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling Jan Stancek
@ 2013-10-03 11:32 ` Jan Stancek
2013-10-03 12:23 ` chrubis
2013-10-03 11:32 ` [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex Jan Stancek
2013-10-03 12:03 ` [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling chrubis
2 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2013-10-03 11:32 UTC (permalink / raw)
To: ltp-list
Test can hang during startup in following scenario:
main new thread
--------------------------------------------------+-------------------------------------
int create_thread(int prio, pthread_t * tid) |
... |
pthread_create(tid, &attr, thread_func, NULL);|
while (!thread_started) { |
| void *thread_func(void *data)
| thread_started = 1;
| pthread_cond_signal(&cond);
pthread_mutex_lock(&c_mutex); |
132: pthread_cond_wait(&cond, &c_mutex); |
|65: pthread_mutex_lock(&mutex);
|
(gdb) bt
#0 0x00007fd588808f6d in __lll_lock_wait () from /lib64/libpthread.so.0
#1 0x00007fd588804d31 in _L_lock_790 () from /lib64/libpthread.so.0
#2 0x00007fd588804c37 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x0000000000400bba in thread_func (data=0x0) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:65
#4 0x00007fd588802de3 in start_thread () from /lib64/libpthread.so.0
#5 0x00007fd5885300dd in clone () from /lib64/libc.so.6
(gdb) t 2
(gdb) bt
#0 0x00007fd5888066f5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000400d9b in create_thread (prio=5, tid=0x7fffdb562678) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:132
#2 0x0000000000400e82 in main () at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:174
Fix this by using same c_mutex in thread_func for updating
thread_started and signalling cond.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../interfaces/pthread_attr_setschedpolicy/2-1.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
index 6c471d6..80ce906 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
@@ -56,10 +56,16 @@ static void *thread_func(void *data)
if (rc)
FAIL_AND_EXIT("pthread_getschedparam()", rc);
+ rc = pthread_mutex_lock(&c_mutex);
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_lock()", rc);
thread_started = 1;
rc = pthread_cond_signal(&cond);
if (rc)
FAIL_AND_EXIT("pthread_cond_signal()", rc);
+ rc = pthread_mutex_unlock(&c_mutex);
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
rc = pthread_mutex_lock(&mutex);
if (rc)
@@ -109,19 +115,17 @@ static int create_thread(int prio, pthread_t * tid)
if (rc)
FAIL_AND_EXIT("pthread_create()", rc);
+ rc = pthread_mutex_lock(&c_mutex);
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_lock()", rc);
while (!thread_started) {
- rc = pthread_mutex_lock(&c_mutex);
- if (rc)
- FAIL_AND_EXIT("pthread_mutex_lock()", rc);
-
rc = pthread_cond_wait(&cond, &c_mutex);
if (rc)
FAIL_AND_EXIT("pthread_cond_wait()", rc);
-
- rc = pthread_mutex_unlock(&c_mutex);
- if (rc)
- FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
}
+ rc = pthread_mutex_unlock(&c_mutex);
+ if (rc)
+ FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
pthread_attr_destroy(&attr);
--
1.7.1
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup
2013-10-03 11:32 ` [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup Jan Stancek
@ 2013-10-03 12:23 ` chrubis
0 siblings, 0 replies; 10+ messages in thread
From: chrubis @ 2013-10-03 12:23 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> Test can hang during startup in following scenario:
>
> main new thread
> --------------------------------------------------+-------------------------------------
> int create_thread(int prio, pthread_t * tid) |
> ... |
> pthread_create(tid, &attr, thread_func, NULL);|
> while (!thread_started) { |
> | void *thread_func(void *data)
> | thread_started = 1;
> | pthread_cond_signal(&cond);
> pthread_mutex_lock(&c_mutex); |
> 132: pthread_cond_wait(&cond, &c_mutex); |
> |65: pthread_mutex_lock(&mutex);
> |
>
> (gdb) bt
> #0 0x00007fd588808f6d in __lll_lock_wait () from /lib64/libpthread.so.0
> #1 0x00007fd588804d31 in _L_lock_790 () from /lib64/libpthread.so.0
> #2 0x00007fd588804c37 in pthread_mutex_lock () from /lib64/libpthread.so.0
> #3 0x0000000000400bba in thread_func (data=0x0) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:65
> #4 0x00007fd588802de3 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007fd5885300dd in clone () from /lib64/libc.so.6
> (gdb) t 2
> (gdb) bt
> #0 0x00007fd5888066f5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> #1 0x0000000000400d9b in create_thread (prio=5, tid=0x7fffdb562678) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:132
> #2 0x0000000000400e82 in main () at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:174
>
> Fix this by using same c_mutex in thread_func for updating
> thread_started and signalling cond.
Looks good.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex
2013-10-03 11:32 [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling Jan Stancek
2013-10-03 11:32 ` [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup Jan Stancek
@ 2013-10-03 11:32 ` Jan Stancek
2013-10-03 12:38 ` chrubis
2013-10-04 6:47 ` [LTP] [PATCH v2 3/3] pthread_attr_setschedpolicy/2-1.c: bind threads to single CPU Jan Stancek
2013-10-03 12:03 ` [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling chrubis
2 siblings, 2 replies; 10+ messages in thread
From: Jan Stancek @ 2013-10-03 11:32 UTC (permalink / raw)
To: ltp-list
Use small sleep for lack of better way to check that all threads
are blocked on mutex "mutex".
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../interfaces/pthread_attr_setschedpolicy/2-1.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
index 80ce906..1f8825a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
@@ -161,6 +161,9 @@ int main(void)
if (rc)
FAIL_AND_EXIT("create_thread HIGH", rc);
+ /* give threads a moment so they can block on mutex "mutex" */
+ sleep(2);
+
rc = pthread_mutex_unlock(&mutex);
if (rc)
FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
--
1.7.1
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex
2013-10-03 11:32 ` [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex Jan Stancek
@ 2013-10-03 12:38 ` chrubis
[not found] ` <997090639.1023118.1380805094088.JavaMail.root@redhat.com>
2013-10-04 6:47 ` [LTP] [PATCH v2 3/3] pthread_attr_setschedpolicy/2-1.c: bind threads to single CPU Jan Stancek
1 sibling, 1 reply; 10+ messages in thread
From: chrubis @ 2013-10-03 12:38 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> Use small sleep for lack of better way to check that all threads
> are blocked on mutex "mutex".
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> .../interfaces/pthread_attr_setschedpolicy/2-1.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
> index 80ce906..1f8825a 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
> @@ -161,6 +161,9 @@ int main(void)
> if (rc)
> FAIL_AND_EXIT("create_thread HIGH", rc);
>
> + /* give threads a moment so they can block on mutex "mutex" */
> + sleep(2);
> +
> rc = pthread_mutex_unlock(&mutex);
> if (rc)
> FAIL_AND_EXIT("pthread_mutex_unlock()", rc);
Hmm, so you did hit the small window for race condition between the new
thread signals the main thread that it's executed and the next call to
the mutex_lock on the tested mutex?
I do not like this solution much, but this is not easy to do properly.
One posibility is to pinpoint the threads on one cpu via the affinity()
interface (open_posix_testsuite/include/affinity.h) then we can wait in
the main thread until the thread with lowest priority is executed and
safely say that the rest is locked on the mutex allready (as they run
with FIFO scheduling).
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread* [LTP] [PATCH v2 3/3] pthread_attr_setschedpolicy/2-1.c: bind threads to single CPU
2013-10-03 11:32 ` [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex Jan Stancek
2013-10-03 12:38 ` chrubis
@ 2013-10-04 6:47 ` Jan Stancek
2013-10-14 12:00 ` chrubis
1 sibling, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2013-10-04 6:47 UTC (permalink / raw)
To: ltp-list
To make sure that threads are blocked on mutex, bind all to single CPU.
Because they all use SCHED_FIFO policy with main thread having the lowest
priority, main will progress only after three created threads block on
mutex.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../interfaces/pthread_attr_setschedpolicy/2-1.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
index 80ce906..af8e3e4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
@@ -20,6 +20,7 @@
* Date: 20/05/2011
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <pthread.h>
@@ -27,11 +28,13 @@
#include <stdlib.h>
#include <errno.h>
#include <posixtest.h>
+#include <affinity.h>
/* Priorities for the threads, must be unique, non-zero, and ordered */
#define PRIO_HIGH 20
#define PRIO_MED 10
#define PRIO_LOW 5
+#define PRIO_MAIN 1
static int priorities[3];
@@ -142,9 +145,20 @@ int main(void)
pthread_t t1;
pthread_t t2;
pthread_t t3;
+ struct sched_param sp;
status = PTS_UNRESOLVED;
+
+ rc = set_affinity(0);
+ if (rc)
+ FAIL_AND_EXIT("set_affinity", errno);
+
+ sp.sched_priority = PRIO_MAIN;
+ rc = pthread_setschedparam(pthread_self(), SCHED_FIFO, &sp);
+ if (rc)
+ FAIL_AND_EXIT("pthread_setschedparam()", rc);
+
rc = pthread_mutex_lock(&mutex);
if (rc)
FAIL_AND_EXIT("pthread_mutex_lock()", rc);
--
1.7.1
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling
2013-10-03 11:32 [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling Jan Stancek
2013-10-03 11:32 ` [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup Jan Stancek
2013-10-03 11:32 ` [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex Jan Stancek
@ 2013-10-03 12:03 ` chrubis
2 siblings, 0 replies; 10+ messages in thread
From: chrubis @ 2013-10-03 12:03 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> Remove all gotos and if there's error in any of pthread
> functions exit immediately.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Looks good.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-10-14 12:00 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-03 11:32 [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling Jan Stancek
2013-10-03 11:32 ` [LTP] [PATCH 2/3] pthread_attr_setschedpolicy/2-1.c: fix race at thread startup Jan Stancek
2013-10-03 12:23 ` chrubis
2013-10-03 11:32 ` [LTP] [PATCH 3/3] pthread_attr_setschedpolicy/2-1.c: give threads a moment to block on mutex Jan Stancek
2013-10-03 12:38 ` chrubis
[not found] ` <997090639.1023118.1380805094088.JavaMail.root@redhat.com>
2013-10-03 13:13 ` chrubis
[not found] ` <1572642675.1045335.1380806767492.JavaMail.root@redhat.com>
2013-10-03 13:46 ` chrubis
2013-10-04 6:47 ` [LTP] [PATCH v2 3/3] pthread_attr_setschedpolicy/2-1.c: bind threads to single CPU Jan Stancek
2013-10-14 12:00 ` chrubis
2013-10-03 12:03 ` [LTP] [PATCH 1/3] pthread_attr_setschedpolicy/2-1.c: simplify error handling chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox