delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/04/07:15:56

X-Spam-Check-By: sourceware.org
Message-ID: <44FC0ABA.80600@sh.cvut.cz>
Date: Mon, 04 Sep 2006 13:15:06 +0200
From: =?ISO-8859-1?Q?V=E1clav_Haisman?= <v DOT haisman AT sh DOT cvut DOT cz>
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Inter-Process Mutexes
References: <BAY24-F18F3FEBE76CC597C84DBDBE330 AT phx DOT gbl>
In-Reply-To: <BAY24-F18F3FEBE76CC597C84DBDBE330@phx.gbl>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

--------------enig7B9B6F0BDCA9F5A5CCE7576F
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Drake Baker wrote:
> Gentlemen,
>=20
> 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.
>=20
> 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.
>=20
> 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).
>=20
> Any solution that will work in CYGWIN and a Linux box would be
> appreciated -- all I need is a critical section for mutliple processes.
>=20
> Thank you in advance for your help!
>=20
> -Drake
>=20
> --- snippets for reference, in case my assumption is wrong (not actual
> code, simplified cuts)
>=20
> ... initializing
> pthread_mutexattr_init(&mattr); // create default attributes, returns no
> error
>=20
> pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); // set for
> inter-process sharing (it is returning EINVAL)
>=20
> pthread_mutex_init(&mutex, &mattr);  // init, returns no error
>=20
> ... locking/etc...
>=20
> 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


--------------enig7B9B6F0BDCA9F5A5CCE7576F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRPwKyENOZDESBK8FAQIuiAgAmkGQEiXoDBxhD6q28IBQb8H1Us8HoySU
s/oz6ynBf8V87gAFNxoNkJFfoUeP534JaDu0KTsdtcrxF27DM0I4PO3NVYYfZqAB
IVt9tS/xcEIBu1DqXwPomJ6vm8eqMfIWqAbv8preH5aH5OHpqN6HjiebISqQUvTP
sHOknhZy1ZJZGXwKUOFlk4PwTqscryxc1vfvuCHgb3JM3n+xgPN07a2l+GZHtvK4
bEJHC5g3eHxI4DxUxHLt0sOc9zNXOoA8SxMwgB05Oh56WQPoYlOvXrhq0oRKxuli
rom224SZcPklSsvCbEKVCL3BhT/GATQrdyHygzTHF12WR092TyURJg==
=W6gy
-----END PGP SIGNATURE-----

--------------enig7B9B6F0BDCA9F5A5CCE7576F--

- Raw text -


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