From 11c531e21de9c417166da934898ea7225a758fdf Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 30 May 2011 01:41:23 -0400 Subject: [PATCH] implement uselocale function (minimal) --- src/internal/pthread_impl.h | 2 ++ src/locale/uselocale.c | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/locale/uselocale.c 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 #include #include +#include #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; +} -- 2.25.1