pthread app crashes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int main()

{


    pthread_t makepi1,makepi2,makepi3,makepi4;

    pthread_create( &makepi1, NULL, pi, NULL);
    pthread_create( &makepi2, NULL, pi, NULL);
    pthread_create( &makepi3, NULL, pi, NULL);

    pthread_join ( makepi1, NULL );
    pthread_join ( makepi2, NULL );
    pthread_join ( makepi3, NULL );

}


the function pi just generates pi to n places. The program crashes at exactly the third join. No such problem with only 2 threads.

Crashes with error code 255.
closed account (S6k9GNh0)
You have several APIs that wrap around any complications with pthread, WinAPI threads, etc. while simplifying their use. Why use them directly?
Last edited on
Topic archived. No new replies allowed.