/* * Criação de uma nova thread, com passagem de identificador como * parâmetro. */ #include #include #include typedef struct { int x, y; } E; void* f_thread(void *v) { E e; e = *(E *) v; printf("Thread x=%d y=%d.\n", e.x, e.y); return NULL; } int main() { pthread_t thr; int thr_id = 1; E e = {0, 1}; pthread_create(&thr, NULL, f_thread, (void*) &e); pthread_join(thr, NULL); return 0; }