mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
5f68cd8242
git-svn-id: file:///svn/toku/tokudb@18191 c7de825b-a66e-492c-adef-691d508d4ae1
31 lines
622 B
C
31 lines
622 B
C
// test for a pthread handle leak
|
|
|
|
#include <test.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <toku_assert.h>
|
|
#include <unistd.h>
|
|
#include <toku_pthread.h>
|
|
|
|
static void *mythreadfunc(void *arg) {
|
|
return arg;
|
|
}
|
|
|
|
int test_main(int argc, char *const argv[]) {
|
|
#define N 1000000
|
|
|
|
int i;
|
|
for (i=0; i<N; i++) {
|
|
int r;
|
|
toku_pthread_t tid;
|
|
r = toku_pthread_create(&tid, NULL, mythreadfunc, (void *)i);
|
|
assert(r == 0);
|
|
void *ret;
|
|
r = toku_pthread_join(tid, &ret);
|
|
assert(r == 0 && ret == (void*)i);
|
|
}
|
|
printf("ok\n"); fflush(stdout);
|
|
return 0;
|
|
}
|
|
|