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]

Hangs in fopen() in multi-threaded app


I am writing an app that for the most part uses only one thread but creates a temporary thread once in a while to generate reports and email them. The problem is when the second thread attempts to fopen() a file for writing, it hangs. The main thread continues to run until the next time it calls a file function (in my case, fclose() hangs). I experience the same hangs even when I protect the code with a mutex.

Here's where it gets interesting. If I run this under my native desktop OS (Windows XP Pro), it works fine. The hanging only happens on my VMWare test system. Plus, my system is a P4 3.06 GHz with Hyperthreading. I have experienced some random (although infrequent) hangs on the native OS when running bash, etc., but I can never reproduce them at the same spot. In my application, it always hangs in fopen().

This leads me to ask the following:

1.) Would the known Hyperthreading issues in Cygwin happen in a VMWare machine and not the native host? (I suppose I could disable HT and see if it makes a difference, which I'll post the results of.)

2.) Is there anything in the file I/O routines that are not thread-safe?

3.) Is there something else I need to do in order to avoid this type of deadlock?

If a code sample would help, I could post one (or send privately). My app is open source, so I'd be willing to send it off to someone if they'd be interested. Thanks for any ideas.

-Brian

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