Mail Archives: cygwin/2006/09/04/07:15:56
--------------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 -