This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Inter-Process Mutexes


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

_________________________________________________________________
Get real-time traffic reports with Windows Live Local Search http://local.live.com/default.aspx?v=2&cp=42.336065~-109.392273&style=r&lvl=4&scene=3712634&trfc=1



-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]