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: Fwd: Got any 'fileno_unlocked'?


On Fri, May 12, 2006 at 12:49:36PM -0700, Brian Dessent wrote:
> 
> 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.
>[...]
> 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

Shouldn't the existance of .*_unlocked functions come into scope
after defining _REENTRANT ? I know that even on Solaris, you will
see malloc_unlocked() etc. calls, but mainly in threads programs.

Even including a threaded header (pthreads.h, thread.h) should
define _REENTRANT, so the specific definition isn't necessarily
required but I just wonder why a developer would go out of their
way to even call these backend functions. Bad mojo there for sure.

-cl

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