Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <41F09F30.6070004@poldon.com> Date: Thu, 20 Jan 2005 22:20:32 -0800 From: "Brian C. Wiles" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Hangs in fopen() in multi-threaded app Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/