summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-06-03 22:03:27 +0200
committerAndreas Baumann <abaumann@yahoo.com>2010-06-03 22:03:27 +0200
commit58f1c192c2aa58d959ecb69197b2650b27f2eb7d (patch)
tree99f7cad6c22626498a443fd0187e7bbf9e9b9ce0 /tests
parentd1825f38cf363be594af0e566ab91eb75e4c0376 (diff)
downloadwolfbones-58f1c192c2aa58d959ecb69197b2650b27f2eb7d.tar.gz
wolfbones-58f1c192c2aa58d959ecb69197b2650b27f2eb7d.tar.bz2
can pass thread data now (Linux), adapted tests
Diffstat (limited to 'tests')
-rw-r--r--tests/threads/test_counter_mutex.c2
-rw-r--r--tests/threads/test_create_join.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/threads/test_counter_mutex.c b/tests/threads/test_counter_mutex.c
index af28f6f..b827d15 100644
--- a/tests/threads/test_counter_mutex.c
+++ b/tests/threads/test_counter_mutex.c
@@ -72,7 +72,7 @@ int main( void ) {
for( j = 0; j < NOF_LOOPS; j++ ) {
for( i = 0; i < NOF_THREADS; i++ ) {
- error = wolf_thread_create( &thread[i], thread_func );
+ error = wolf_thread_create( &thread[i], thread_func, NULL );
if( error != WOLF_OK ) {
fprintf( stderr, "Unable to start thread %d: %d\n", i, error );
return EXIT_FAILURE;
diff --git a/tests/threads/test_create_join.c b/tests/threads/test_create_join.c
index 12b39d3..0eaa6a6 100644
--- a/tests/threads/test_create_join.c
+++ b/tests/threads/test_create_join.c
@@ -25,14 +25,19 @@
#define NOF_ITERATIONS 10000
static WOLF_THREAD_RETURN_DECL thread_func( void *thread_data ) {
+ int thread_id = *((int *)thread_data);
int i;
+ printf( "Starting thread %d\n", thread_id );
+ fflush( stdout );
+
for( i = 0; i < NOF_ITERATIONS; i++ ) {
printf( "%d\n", i );
fflush( stdout );
}
- WOLF_UNUSED( thread_data );
+ printf( "Terminating thread %d\n", thread_id );
+ fflush( stdout );
WOLF_THREAD_RETURN
}
@@ -41,9 +46,11 @@ int main( void ) {
int i;
wolf_thread_t thread[NOF_THREADS];
wolf_error_t error;
+ int thread_data[NOF_THREADS];
for( i = 0; i < NOF_THREADS; i++ ) {
- error = wolf_thread_create( &thread[i], thread_func );
+ thread_data[i] = i;
+ error = wolf_thread_create( &thread[i], thread_func, (void *)&thread_data[i] );
if( error != WOLF_OK ) {
fprintf( stderr, "Unable to start thread %d: %d\n", i, error );
return EXIT_FAILURE;