mixed usage of lock protection and lock-free List template class in thread.h

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Feb 14 14:30:00 GMT 2018


On Feb 14 07:37, Xiaofeng Liu via cygwin wrote:
> Sorry, I need send again for another try for the formatting.
> 
> 
> (Yahoo deleted my spaces. Please reformat the code in your C++ editor
> if you want to use the code. Sorry!)

You may want to use a good old MUA like thunderbird or mutt :}

> Here is the sample code that will hang in cygwin: test-thread.cpp
> to compile: 
> g++ -std=c++0x test-thread.cpp -lpthread 
> In this code, mutex and cond need be created and destroyed very
> frequently, which could corrupt the static list object owned by some
> classes in thread.h. In my test, I have a computer of 8 threads to run
> cygwin, and the hang could happen when cond/mutex objects are created
> and destroyed for the order of 1 millions times within a few minutes.
> Is this practical? Yes. My code for my product used a lot of
> std::future which use one mutex and one mutex for each object. The
> future objects are created and destroyed on the flight, so are for
> mutex and cond variables.  I can also observe that the peak memory
> kept increasing to a few hundred MB, and I suspect there is a MEMORY
> LEAK in cygwin kernel. 
> I hope the format will be good. If not, I will try again.

The leading spaces are still gone but at least the linefeeds have been
retained, so all is good.  Note that this is not sufficient for patch
submissions.  Make sure to send them as attachment as long as you're
using a broken MUA.

Thanks for the example.  If you can come up with a patch for a lockless
implementation this would be highly appreciated.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180214/83186b78/attachment.sig>


More information about the Cygwin mailing list