X-Spam-Check-By: sourceware.org Message-ID: <4464E6D0.1C835CBC@dessent.net> Date: Fri, 12 May 2006 12:49:36 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Fwd: Got any 'fileno_unlocked'? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com 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 Rick Hanson wrote: > Thanks for the tip. I already tried knocking off the '_unlocked' > suffix. Although it does compile, I wonder what kind of runtime > trouble I'm going to get into, since I did notice, by scanning the > code, that the programmer locks his own file, then appeals to > 'fileno_unlocked'. Also, there is no configure script to help. I think you are misunderstanding the purpose of these functions. It has nothing to do with file locking, but rather locking in the sense of thread-safety. A programmer can call the _unlocked version of a number of functions when he is sure that the application only has one thread, and avoid a very slight penalty of having to set a mutex before modifying the data structures. Therefore, calling the standard version instead of the _unlocked version is just skipping this optimization and should work in all cases. In fact, if anything should be considered unsafe it is the _unlocked function, which if used improperly will certainly cause harm, unlike the standard functions. Furthermore, these _unlocked functions are *not* standardized functions, they are GNU extensions, and this means the programmer has made his code unportable by assuming they exist without the aid of a configure test. This is a bad thing to do. 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/