testfrmw:disable thread cancelability while output is running
PATCH v2 1/1 testfrmw:disable thread cancelability while output is running
Function output can be canceled by pthread_cancel(), which, maybe, leads to a deadlock as it calls pthread_mutex_lock(). That's catched in case "pthread_join/4-1.c".
So,disable thread cancelability until output finishes.
--- .../conformance/interfaces/testfrmw/testfrmw.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c +4 -0
@@ -28,6 +28,7 @@#include <time.h> #include <sys/types.h> +#include <pthread.h> /* We use a mutex to avoid conflicts in traces */ static pthread_mutex_t m_trace =PTHREAD_MUTEX_INITIALIZER ;
@@ -43,7 +44,9 @@ void output(char *string, ...)char *ts ="[??:??:??]" ;struct tm *now;time_t nw; +int oldstate; +pthread_setcancelstate (PTHREAD_CANCEL_DISABLE , &oldstate);pthread_mutex_lock (&m_trace); nw =time (NULL ); now =localtime (&nw);
@@ -56,6 +59,7 @@ void output(char *string, ...)vprintf (string, ap);va_end (ap);pthread_mutex_unlock (&m_trace); +pthread_setcancelstate (oldstate,NULL ); }void output_fini (void )
Signature · 11 lines
1.7.1 ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · lidan
Function output can be canceled by
pthread_cancel(), which, maybe, leads to a deadlock as it callspthread_mutex_lock(). That's catched in case "pthread_join/4-1.c".So,disable thread cancelability until output finishes.
Looks good.
Thanks,
Wanlong Gao
Quoted 29 lines
Signed-off-by DAN LI <[email protected]>--- .../conformance/interfaces/testfrmw/testfrmw.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c +3
-0@@ -28,6 +28,7 @@#include <time.h> #include <sys/types.h> +#include <pthread.h> /* We use a mutex to avoid conflicts in traces */ static pthread_mutex_t m_trace =PTHREAD_MUTEX_INITIALIZER ;@@ -43,7 +44,9 @@ void output(char *string, ...)char *ts ="[??:??:??]" ;struct tm *now;time_t nw; +int oldstate; +pthread_setcancelstate (PTHREAD_CANCEL_DISABLE , &oldstate);pthread_mutex_lock (&m_trace); nw =time (NULL ); now =localtime (&nw);
testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c void output(char *string, ...) · line 65
Quoted 7 lines
testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c +1
-0@@ -56,6 +59,7 @@ void output(char *string, ...)vprintf (string, ap);va_end (ap);pthread_mutex_unlock (&m_trace); +pthread_setcancelstate (oldstate,NULL ); }void output_fini (void )
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · lidan
Function output can be canceled by
pthread_cancel(), which, maybe, leads to a deadlock as it callspthread_mutex_lock(). That's catched in case "pthread_join/4-1.c".So,disable thread cancelability until output finishes.
pushed, thanks,
Wanlong Gao
Quoted 29 lines
Signed-off-by DAN LI <[email protected]>--- .../conformance/interfaces/testfrmw/testfrmw.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c +3
-0@@ -28,6 +28,7 @@#include <time.h> #include <sys/types.h> +#include <pthread.h> /* We use a mutex to avoid conflicts in traces */ static pthread_mutex_t m_trace =PTHREAD_MUTEX_INITIALIZER ;@@ -43,7 +44,9 @@ void output(char *string, ...)char *ts ="[??:??:??]" ;struct tm *now;time_t nw; +int oldstate; +pthread_setcancelstate (PTHREAD_CANCEL_DISABLE , &oldstate);pthread_mutex_lock (&m_trace); nw =time (NULL ); now =localtime (&nw);
testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c void output(char *string, ...) · line 65
Quoted 7 lines
testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c +1
-0@@ -56,6 +59,7 @@ void output(char *string, ...)vprintf (string, ap);va_end (ap);pthread_mutex_unlock (&m_trace); +pthread_setcancelstate (oldstate,NULL ); }void output_fini (void )
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list