[so] [Tema4][lin]pthread_create

Maria parcalabescu_maria at yahoo.com
Sun May 12 15:29:40 EEST 2013


Buna ziua,

Am si eu o problema: pthread_create intoarce valoarea 0(succes) dar functia
care o dau ca parametru nu este apelata. Am rulat cu gdb si imi arata ca un
thread a fost creat.

void* start_thread (void* arguments) {

	printf ("thread\n");
        pthread_exit (0);
}

ret = pthread_create (&(thd->id), NULL, start_thread, (void*)(&arg));
printf ("create %d\n", ret);

Programul se executa fara erori, afiseaza create 0, dar printf-ul din
start_thread nu este executat.

In gdb:

[New Thread 0xb7cc2b40 (LWP 7667)]
create 0
[Thread 0xb7cc4700 (LWP 7663) exited]
[Inferior 1 (process 7663) exited normally]

Multumesc.



More information about the so mailing list