mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-13 04:29:09 +08:00
Cygwin: message queues: avoid deadlocks in multi-threaded processes
Deadlocks have been observed if the message queue functions are called from different threads in the same process. Remove incorrectly locking the descriptor table while accessing the message queue fhandler, potentially calling blocking functions. Fixes: 46f3b0ce85a9 ("Cygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueue") Reported-by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
b940faa144
commit
fe6ddc15a3
@ -224,7 +224,7 @@ mq_getattr (mqd_t mqd, struct mq_attr *mqstat)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
cygheap_fdget fd ((int) mqd, true);
|
||||
cygheap_fdget fd ((int) mqd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
fhandler_mqueue *fh = fd->is_mqueue ();
|
||||
@ -241,7 +241,7 @@ mq_setattr (mqd_t mqd, const struct mq_attr *mqstat, struct mq_attr *omqstat)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
cygheap_fdget fd ((int) mqd, true);
|
||||
cygheap_fdget fd ((int) mqd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
fhandler_mqueue *fh = fd->is_mqueue ();
|
||||
@ -258,7 +258,7 @@ mq_notify (mqd_t mqd, const struct sigevent *notification)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
cygheap_fdget fd ((int) mqd, true);
|
||||
cygheap_fdget fd ((int) mqd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
fhandler_mqueue *fh = fd->is_mqueue ();
|
||||
@ -276,7 +276,7 @@ mq_timedsend (mqd_t mqd, const char *ptr, size_t len, unsigned int prio,
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
cygheap_fdget fd ((int) mqd, true);
|
||||
cygheap_fdget fd ((int) mqd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
fhandler_mqueue *fh = fd->is_mqueue ();
|
||||
@ -300,7 +300,7 @@ mq_timedreceive (mqd_t mqd, char *ptr, size_t maxlen, unsigned int *priop,
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
cygheap_fdget fd ((int) mqd, true);
|
||||
cygheap_fdget fd ((int) mqd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
fhandler_mqueue *fh = fd->is_mqueue ();
|
||||
|
@ -3,3 +3,7 @@ Fixes:
|
||||
|
||||
- Fix stat() on message queues.
|
||||
Addresses: https://cygwin.com/pipermail/cygwin/2025-January/257186.html
|
||||
|
||||
- Avoid deadlocks when calling message queue functions from different threads
|
||||
in the same process.
|
||||
Addresses: https://cygwin.com/pipermail/cygwin/2025-January/257120.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user