Hi,
there is a branch of gfortran for implementing coarrays based on a shared memory implementation instead of MPI, the devel_coarray/native branch. I tried it out on Cygwin, but it doesn't work there (hangs on the first sync). The branch uses pthread mutexes and condition variables with PTHREAD_PROCESS_SHARED for synchronization between processes. I also ran the attached test program, which gave the output pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)failed: No error Is it correct that PTHREAD_PROCESS_SHARED is not supported on Cygwin? Is it supported for condition variables, or is the fact that it is reported as working an oversight? If PTHREAD_PROCESS_SHARED does not work, are there known workarounds? Best regards Thomas
#include <errno.h> #include <fcntl.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <unistd.h> #define ERR_CHK(x) \ do { \ if (x) { \ perror(#x "failed"); \ exit(1); \ } \ } while (0) int main(int argc, char **argv) { pthread_condattr_t cattr; pthread_mutexattr_t mattr; pthread_mutex_t *m; pthread_cond_t *c; void *mem; ERR_CHK((mem = mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0)) == MAP_FAILED); m = mem; c = mem + 0x800; ERR_CHK(pthread_mutexattr_init(&mattr)); ERR_CHK(pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)); ERR_CHK(pthread_mutex_init(m, &mattr)); ERR_CHK(pthread_mutexattr_destroy(&mattr)); ERR_CHK(pthread_condattr_init(&cattr)); ERR_CHK(pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED)); ERR_CHK(pthread_cond_init(c, &cattr)); ERR_CHK(pthread_condattr_destroy(&cattr)); printf("Success\n"); return 0; }
-- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple