Per-thread locale in linux

Is it possible to specify per-thread in Linux?


No. setlocale(3) changes it for the whole process.

Yes, you kinda can do that. However not per-thead, but only per-call, using locale_t structures.

Read more about that at POSIX:

And Ulrich Dreppper's dedsgin documents of what whent into glibc 2.1:

Category:c# Time:2010-02-17 Views:1

Related post

  • Thread local data in linux kernel module 2011-09-13

    Is it possible to create thread local data in a linux kernel module? I need to store some data for each process/thread calling my module. Is there an easy way of using thread local data, or do I have to resort to writing a hash map which uses the pid

  • How fast is thread local variable access on Linux 2012-03-28

    How fast is accessing a thread local variables in Linux. From the code generated by the gcc compiler, I can see that is uses the fs segment register. So apparently, the access to the thread local variable should not cost extra cycles. However, I keep

  • Linux's thread local storage implementation 2010-03-17

    __thread Foo foo; How is "foo" actually resolved? Does the compiler silently replace every instance of "foo" with a function call? Is "foo" stored somewhere relative to the bottom of the stack, and the compiler stores this as "hey, for each thread, h

  • Why is thread local storage so slow? 2009-02-03

    I'm working on a custom mark-release style memory allocator for the D programming language that works by allocating from thread-local regions. It seems that the thread local storage bottleneck is causing a huge (~50%) slowdown in allocating memory fr

  • Why would shl_load() fail for libraries with Thread Local Storage? 2009-04-30

    Threads in Perl by default take their own local storage for all variables, to minimise the impact of threads on existing non-thread-aware code. In Perl, a thread-shared variable can be created using an attribute: use threads; use threads::shared; my

  • On which platforms is thread local storage limited and how much is available? 2009-09-22

    I was recently made aware that thread local storage is limited on some platforms. For example, the docs for the C++ library boost::thread read: "Note: There is an implementation specific limit to the number of thread specific storage objects that can

  • How does a C++ compiler implement thread local storage in C++0x? 2010-09-17

    How does c++ complier implement thread local storage in C++0x I have searched this in google. But I can't find anything about this. Does anyone have any material about this ?? --------------Solutions------------- Have a read of the Wikipedia entry. T

  • how to compile thread local storage (TLS) on 64-bit solaris sparc with g++ 2010-11-08

    I have a piece of C/C++ code that uses __thread keyword for thread local storage but having trouble getting it compiled on 64-bit Solaris Sparc with g++ (version 4.0.2), while it compiles and runs OK on linux with g++34 compiler. Here is an example o

  • Access thread-local from another thread 2011-03-15

    How can I read/write a thread local variable from another thread? That is, in Thread A I would like to access the variable in Thread B's thread local storage area. I know the ID of the other thread. The variable is declared as __thread in GCC. Target

  • How to allocate thread local storage? 2011-05-16

    I have a variable in my function that is static, but I would like it to be static on a per thread basis. How can I allocate the memory for my C++ class such that each thread has its own copy of the class instance? AnotherClass::threadSpecificAction()

  • Python's multiprocessing Does Not Play Nicely With threading.local? 2011-09-02

    I have two processes (see sample code) that each attempt to access a threading.local object. I would expect the below code to print "a" and "b" (in either order). Instead, I get "a" and "a". How can I elegantly and robustly reset the threading.local

  • How to define thread-local local static variables? 2011-09-30

    How to define local static variables (that keeps its value between function calls) that are not shared among different threads? I am looking for an answer both in C and C++ --------------Solutions------------- on Windows using Windows API: TlsAlloc()

  • Boost thread local storage in Windows threads 2011-10-30

    I tried to use Boost thread local storage with Windows threads. I built the project without any problems. However my question here is, is it okay to use Boost TLS with Windows threads? --------------Solutions------------- Edit Yes Boost is integrally

  • Memory leak when using shared library with thread local storage via ctypes in a python program 2011-11-10

    I am using the ctypes module in python to load a shared c-library , which contains thread local storage. Its a quite large c-library with a long history, that we are trying to make thread safe. The library contains lots of global variables and static

  • Strncpy to a thread local variable 2012-03-07

    I had an interesting question. I am passing an error string from Linux kernel to userspace. I have a library in user space with api's. The applications link to this library. When applicaiton call the api, an ioctl is invoked and I pass a stack variab

  • How to find a Java thread running on Linux with ps -axl? 2012-03-29

    I have a running JVM with two threads. Is it possible to see these running threads on my Linux OS with ps -axl ? I am trying to find out what priority the OS is giving to my threads. More info about this other issue here. --------------Solutions-----

  • Reading registers or thread local variables of another thread 2012-04-03

    Is it possible to read the registers or thread local variables of another thread directly, that is, without requiring to go to the kernel? What is the best way to do so? --------------Solutions------------- You can't read the registers, which wouldn'

  • What is "thread local storage" in Python, and why do I need it? 2008-09-19

    In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only

  • What are best practices for using thread local storage in .NET? 2008-10-06

    I have a requirement in my application that I think can be met by using thread local storage, but I'm wondering if it's one of those things that's best to avoid. I have read a few articles on the subject:

Copyright (C), All Rights Reserved.

processed in 0.651 (s). 13 q(s)