[RFA]: fork safe stdio locks

Thomas Pfaff tpfaff@gmx.net
Mon Mar 8 20:22:00 GMT 2004


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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: findfp.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20040308/5dd73e66/attachment.ksh>


More information about the Newlib mailing list