This is the mail archive of the cygwin-patches@cygwin.com 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: [PATCH] Thread safe stdio


Christopher Faylor wrote:
On Wed, Feb 11, 2004 at 11:08:57AM +0100, Thomas Pfaff wrote:

The __sinit call must be done after malloc is initialized, otherwise the mutex creation will fail.


I am not comfortable with this part of the patch.  I moved the __sinit
call where I did for a reason.  It needed to be called earlier in the
process.  I'm also somewhat uncomfortable with using malloc for this
purpose in general.  It seems like a heavyweight solution to something
that could be solved with either a muto or a critical section.



Please keep in mind that:


- There does not exist only one mutex, every file has its own that is created on fopen and destroyed when it is closed.

- I do not call malloc directly, it is called as part of the mutex creation.

- Every mutex that is associated with an open file must be fork save, it has to be recreated after a fork.

- _flock_t can not be a CRITICAL_SECTION nor class muto. You can not implement newlibs _LOCK_INIT macro with this types, i have not seen something like a CRITICAL_SECTION_INITIALIZER or a MUTO_INITIALIZER.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]