summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-05-30 01:41:23 -0400
committerRich Felker <dalias@aerifal.cx>2011-05-30 01:41:23 -0400
commit11c531e21de9c417166da934898ea7225a758fdf (patch)
treeb70cd41e7a7b9304235a3eb0f09d9c4d335efb38 /src
parent9a59faab3c0c46d2e96245e11fc71351caba1a2e (diff)
downloadmusl-11c531e21de9c417166da934898ea7225a758fdf.tar.gz
implement uselocale function (minimal)
Diffstat (limited to 'src')
-rw-r--r--src/internal/pthread_impl.h2
-rw-r--r--src/locale/uselocale.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index 615713c7..219bf006 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -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
index 00000000..9c799578
--- /dev/null
+++ b/src/locale/uselocale.c
@@ -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;
+}