ftmemsim-valgrind/drd/tests/pth_create_glibc_2_0.c
Bart Van Assche 0346c9a310 Added more comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9664
2009-04-28 11:19:43 +00:00

40 lines
809 B
C

/*
* Test program that invokes pthread_create@GLIBC_2.0().
*
* Note: pthread_create@GLIBC_2.0() is only available in 32-bit glibc versions,
* not in 64-bit versions.
*/
#include <pthread.h>
#include <stdio.h>
extern int pthread_create_glibc_2_0(pthread_t*, const pthread_attr_t*,
void *(*)(void*), void*);
__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
static void* thread_func(void *arg)
{
fprintf(stderr, "The thread.\n");
return 0;
}
int main(int argc, char** argv)
{
int result;
pthread_t thr;
result = (*pthread_create_glibc_2_0)(&thr, 0, thread_func, 0);
if (result != 0)
{
fprintf(stderr, "pthread_create() failed.\n");
return 1;
}
pthread_join(thr, 0);
fprintf(stderr, "Finished.\n");
return 0;
}