[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix libunistring in MS-Windows locales
From: |
Daiki Ueno |
Subject: |
Re: Fix libunistring in MS-Windows locales |
Date: |
Fri, 18 Jul 2014 16:06:11 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Daiki Ueno <address@hidden> writes:
> I could be wrong and perhaps it might not be a problem with the recent
> MinGW releases.
FWIW I just tried myself (on wine, though) and it seems to work with:
- GCC 4.8.3 (Fedora mingw64-gcc package, cross compiling)
- GCC 4.7.2 (mingw-w32-bin_i686-mingw_20111219, self compiling)
So, I guess it is OK to use __thread, though other 3 static variables
(lname, last_lcid, and last_locale) would also need the same care.
For the archive, I'm attaching a test program:
#include <config.h>
#include <windows.h>
#include <locale.h>
#include <localename.h>
#include <process.h>
#include <stdio.h>
static void
func (LPVOID p)
{
char *locale = (char *) p;
_configthreadlocale (_ENABLE_PER_THREAD_LOCALE);
setlocale (LC_CTYPE, locale);
while (1)
{
const char *actual = gl_locale_name_thread (LC_CTYPE, "LC_CTYPE");
if (actual == NULL || strcmp (actual, locale) != 0)
printf ("%s != %s\n", actual, locale);
}
}
int
main (void)
{
HANDLE threads[2];
threads[0] = (HANDLE) _beginthread (func, 0, "de_DE");
threads[1] = (HANDLE) _beginthread (func, 0, "ja_JP");
WaitForMultipleObjects (2, threads, TRUE, INFINITE);
CloseHandle (threads[0]);
CloseHandle (threads[1]);
return 0;
}
Regards,
--
Daiki Ueno
- Re: Fix libunistring in MS-Windows locales, (continued)
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/15
- Re: Fix libunistring in MS-Windows locales, Paul Eggert, 2014/07/15
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/15
- Re: Fix libunistring in MS-Windows locales, Daiki Ueno, 2014/07/16
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/16
- Re: Fix libunistring in MS-Windows locales, Daiki Ueno, 2014/07/17
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/17
- Re: Fix libunistring in MS-Windows locales, Paul Eggert, 2014/07/17
- Re: Fix libunistring in MS-Windows locales, Daiki Ueno, 2014/07/17
- Re: Fix libunistring in MS-Windows locales,
Daiki Ueno <=
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/18
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/18
- Re: Fix libunistring in MS-Windows locales, Daiki Ueno, 2014/07/18
- Re: Fix libunistring in MS-Windows locales, Eli Zaretskii, 2014/07/19