I'm having trouble passing a pointer to a structure as an argument to a thread cancellation cleanup handler. Here's some sample code that blows up when it hits the compiler. Any idea what I'm doing wrong?
#include <pthread.h>
typedef struct struct_def {
/* data */
} struct_def;
struct_def *ptr_to_struct_def;
void *
thread_function(void *arg)
{
pthread_cleanup_push(cleanup, (void *)ptr_to_struct_def); /* correct? */
/* function continues */
}
int
main()
{
int err;
pthread_t tid;
err = pthread_create(&tid1, NULL, thread_function, (void *)1);
/* main continues */
}