Drake Baker wrote: > Gentlemen, > > I have seen conflicting information on the web concerning inter-process > mutexes in CYGWIN. I have seen outright statements that it is not > supported, and I have seen statements that ALL mutexes are inter-process > by default. Obviously, only one statement is currently correct. > > The bottom line is that I have some shared memory and multiple processes > -- basically a critical section. I need a technique to implement the > critical section, and preferably a solution that is portable. > > I have tried for countless hours over the last few days before > concluding that process shared mutexes don't exist in CYGWIN despite > some google results implying they do. (I hope I am wrong, and it does > support them). > > Any solution that will work in CYGWIN and a Linux box would be > appreciated -- all I need is a critical section for mutliple processes. > > Thank you in advance for your help! > > -Drake > > --- snippets for reference, in case my assumption is wrong (not actual > code, simplified cuts) > > ... initializing > pthread_mutexattr_init(&mattr); // create default attributes, returns no > error > > pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); // set for > inter-process sharing (it is returning EINVAL) > > pthread_mutex_init(&mutex, &mattr); // init, returns no error > > ... locking/etc... > > pthread_mutex_lock(&mutex) // returns no error in process that init'd > mutex, EINVAL in other processes Cygwin has System V semaphores and shared memory. You can use that.
-- VH
signature.asc
Description: OpenPGP digital signature