delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/04/02:49:49

X-Spam-Check-By: sourceware.org
Message-ID: <BAY24-F18F3FEBE76CC597C84DBDBE330@phx.gbl>
X-Sender: drbtq AT hotmail DOT com
From: "Drake Baker" <drbtq AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Inter-Process Mutexes
Date: Mon, 04 Sep 2006 01:49:25 -0500
Mime-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019