pthread_barrier_wait/2-1.c: using mutext to protect global variable used by muti-thread
PATCH 1/1 pthread_barrier_wait/2-1.c: using mutext to protect global variable used by muti-thread
Hi all
This patch are for POSIX test suite. using mutext to protect global
variable accessed by muti-threads. This ensures that it is a atomic operation, increasing global variable.
Thanks and Regards
wei
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 using mutex to protect the global variable accessed by muti-threads
From: Wei Yang <[email protected]>
--- .../interfaces/pthread_barrier_wait/2-1.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c +4 -1
@@ -38,6 +38,7 @@static pthread_barrier_t barrier;static int serial;static int normal_rt; +static pthread_mutex_t mutex =PTHREAD_MUTEX_INITIALIZER ;static void *fn_chld (void *arg) {
@@ -59,7 +60,9 @@ static void* fn_chld(void *arg) }else { +pthread_mutex_lock (&mutex); normal_rt++; +pthread_mutex_unlock (&mutex); }pthread_exit (0 );
@@ -122,4 +125,4 @@ int main()printf ("\nTest PASSED\n" );return PTS_PASS ; -} +}
Signature · 13 lines
1.7.0.2 ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 1/1] using mutex to protect the global variable accessed by muti-threads
Hi!
Quoted 5 lines
Signed-off-by Wei Yang <[email protected]>--- .../interfaces/pthread_barrier_wait/2-1.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
Commited, thanks.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list