implement uselocale function (minimal)
authorRich Felker <dalias@aerifal.cx>
Mon, 30 May 2011 05:41:23 +0000 (01:41 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 30 May 2011 05:41:23 +0000 (01:41 -0400)
src/internal/pthread_impl.h
src/locale/uselocale.c [new file with mode: 0644]

index 615713c7441b3c7b69a922eb0b876570ae97cb59..219bf006d51beb491a8c0d77ec8bada802f2bdbf 100644 (file)
@@ -12,6 +12,7 @@
 #include <setjmp.h>
 #include <string.h>
 #include <time.h>
+#include <locale.h>
 #include "libc.h"
 #include "syscall.h"
 #include "atomic.h"
@@ -44,6 +45,7 @@ struct pthread {
        } robust_list;
        int unblock_cancel;
        int delete_timer;
+       locale_t locale;
 };
 
 struct __timer {
diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c
new file mode 100644 (file)
index 0000000..9c79957
--- /dev/null
@@ -0,0 +1,10 @@
+#include "locale_impl.h"
+#include "pthread_impl.h"
+
+locale_t uselocale(locale_t l)
+{
+       pthread_t self = pthread_self();
+       locale_t old = self->locale;
+       if (l) self->locale = l;
+       return old;
+}