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]

Re: 1.5.10: msgsnd between threads hangs, between processes ok..


On Aug 23 14:24, Don Post wrote:
> I have encountered a problem which I hope someone has seen and has a
> work around for. While I was porting some code that is based on POSIX
> threads and SYSV message queues I found that if the receiver (i.e.
> caller to msgrcv) of the message queue is a child or sibling thread of
> the sender (i.e. caller to msgsnd), then the msgsnd call hangs
> indefinitely even though NOWAIT is specified. If the receiver (caller to
> msgrcv) is another process, then all works fine. I have included a
> simple program that spawns the receiver either as a process (i.e. fork)
> or as a thread (pthread_create). When fork is used, all works find. When
> pthread_create is used, the send hangs. Any ideas/workarounds?

The problem is deep inside cygserver.  The current methods only allow
one concurrent call per process.  If one call blocked, the per-process
locking wasn't released, accidentally. 

My fix solves that very problem, so your application won't hang anymore,
but it doesn't change the fact that only one thread per process can run
an IPC call at a time.  I have an idea how to solve that, but that takes
somewhat more time and I'm not sure I want to change that already for the
upcoming Cygwin release.

Thanks for the testcase, it's highly appreciated.  If you want to give
my patch a try, check out the latest Cygwin developers snapshot from
http://www.cygwin.com/snapshots/


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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]