X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Tue, 4 Aug 2009 21:59:21 +0100 Message-ID: <416096c60908041359h3b9697a2n40c82c460e2c2d8@mail.gmail.com> Subject: _setlocale_r From: Andy Koppe To: Cygwin Tech List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 _setlocale_r isn't really reentrant, is it? It invokes loadlocale(), which writes to the global function pointers __mbtowc and __wctomb, i.e. there's a single global locale setting. Its man page needs to be corrected: `_localeconv_r' and `_setlocale_r' are reentrant versions of `localeconv' and `setlocale' respectively. The extra argument REENT is a pointer to a reentrancy structure. (Alternatively, making them reentrant by making the locale settings part of the REENT structure might be rather useful actually, for at least two reasons: different threads could use different locales, and you could convert between different charsets using the the _r versions of the mb functions without having to switch locale all the time.) Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple