This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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: [RFA]: fork safe stdio locks


Patch checked in with slight modification.  I changed the __fp_lock() and
__fp_unlock() routines to use _flockfile() and _funlockfile().

-- Jeff J.

Thomas Pfaff wrote:
As i already mentioned i think that stdio locks should be locked at fork and unlocked in both the parent and the child afterwards to avoid a deadlock in the child process (at least when you are working with pthread mutexes for locking).

The attached patch will add 2 functions to findfp.c which can be called at before and after fork.

Thomas

2004-03-08 Thomas Pfaff <tpfaff@gmx.net>

    * libc/stdio/findfp.c (__sfp): Rename lock to __sfp_lock.
    Change __sfp_lock to static global.
    (__fp_lock): New static function.
    (__fp_unlock): Ditto.
    (__fp_lock_all): New function.
    (__fp_unlock_all): Ditto.


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