Adapted test_pool to the libstrongswan threading.

This commit is contained in:
Tobias Brunner
2010-03-24 18:51:52 +01:00
parent 48aa81a67a
commit dc9ddba6e3
@@ -14,9 +14,9 @@
*/ */
#include <time.h> #include <time.h>
#include <pthread.h>
#include <library.h> #include <library.h>
#include <threading/thread.h>
#define ALLOCS 1000 #define ALLOCS 1000
#define THREADS 20 #define THREADS 20
@@ -69,21 +69,20 @@ static void* testing(void *thread)
******************************************************************************/ ******************************************************************************/
bool test_pool() bool test_pool()
{ {
thread_t *threads[THREADS];
uintptr_t i; uintptr_t i;
void *res;
pthread_t thread[THREADS];
for (i = 0; i < THREADS; i++) for (i = 0; i < THREADS; i++)
{ {
if (pthread_create(&thread[i], NULL, (void*)testing, (void*)i) < 0) if (!(threads[i] = thread_create((thread_main_t)testing, (void*)i)))
{ {
return FALSE; return FALSE;
} }
} }
for (i = 0; i < THREADS; i++) for (i = 0; i < THREADS; i++)
{ {
pthread_join(thread[i], &res); bool *res = threads[i]->join(threads[i]);
if (res == NULL) if (!res)
{ {
return FALSE; return FALSE;
} }