On Sat, Mar 24, 2012 at 2:54 PM, Mark H Weaver
<address@hidden> wrote:
Nala Ginrut <
address@hidden> writes:
> I know it's not the best implementation, I didn't consider the
> multi-threads situation.
Yes, unfortunately there is no way to set the locale on a per-thread
basis. This is a limitation of the C library.
Will it be a proper solution if I use "monitor"?
------------------------------------------------------------------
(define-syntax-rule (with-locale i c e0 e1 ...)
(let ([old (setlocale i)])
(monitor
(dynamic-wind
(lambda () (setlocale i c))
(lambda () (begin e0 e1 ...))
(lambda () (setlocale i old))))))
------------------------------------------------------------------
But I believe it will drag my program based on multi-threads much slowly.
And I'm considering to drop my old design, so that I can set locale to "C" in default.
> in many protocols, it needs
> the result of strftime be in English.
For protocol use, IMO it's better to avoid 'strftime' and other
locale-specific formatting tools. For example, 'write-date' in
module/web/http.scm is a simple date formatter based on SRFI-19.
I guess I should change the old code into new Guile web API. It's more completely.
Regards.