Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[C/C++] pthread parallel execution

Name: Anonymous 2007-08-17 21:38 ID:4NoCXfyk

Just started learning to use POSIX threads, but I find that every time I create a thread and/or join it, the calling thread halts until the called thread completes its iteration. How do I execute them parallel to one another?

Thanks.

Name: Anonymous 2007-08-17 22:05 ID:kRXGqyPR

>>7
I tested your code using the Sun compiler:

$ CC test.cpp -o test -lpthread -mt
"test.cpp", line 23: Warning (Anachronism): Formal argument 3 of type extern "C" void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*, extern "C" void*(*)(void*), void*) is being passed void*(*)(void*).
1 Warning(s) detected.
$ ./test

CalledFunction called
$ jobs
$ time test

real    0m0.000s
user    0m0.000s
sys     0m0.000s
$


Save for the anachronism, it worked fine.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List