Hi, I think I have figured it out:

The issue may be that internally openmp may be allocating thread
identifiers that may already be used by pthread so pthread_join
somehow ends up waiting for the parent thread to finish, deadlocking
itself.

Try this:

#include <cstdio>
#include <omp.h>
#include <pthread.h>

void *do_thread(void *) {       
        int niterations = 200;
        int i;

        #pragma omp parallel for
        for (i = 0; i < niterations; i++)
        {
                printf ("ducks\n");
        }

        return NULL;
}

int main() {
        pthread_t id1, id2;
        
        pthread_create(&id1, NULL, do_thread, NULL);
        pthread_create(&id2, NULL, do_thread, NULL);

        pthread_join (id2, NULL);
        pthread_join (id1, NULL);
}

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to