[질문] TLS(Thread-Local Storage) 사용법
글쓴이: 초보리누그 / 작성시간: 화, 2007/02/06 - 3:34오후
TLS를 사용할려고 하는데 컴파일은 제대로 되는데 작동하는 타겟이 있고 안되는 타겟이 있어서
질문 드립니다. 고수님들 답변 기다리겠습니다. 밑은 참고 내용입니다. 어떤 lib 버전을 사용해야
하는지 갈쳐 주세요. 그리고 /lib/tls가 있던데 이게 어떤 영향을 주는건가요?
http://www.raimokoski.com/docs/HTML/Red_Hat_Manuals/Red_Hat_Enterprise_Linux_Using_the_GNU_Compiler_Collection_(GCC)/thread-local.html
The run-time model GCC uses to implement this originates in the IA-64 processor-specific ABI, but has since been migrated to other processors as well. It requires significant support from the linker (ld), dynamic linker (ld.so), and system libraries (libc.so and libpthread.so), so it is not available everywhere.
Forums:
~$ /lib/libc.so.6 GNU C
~$ /lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1 (Gentoo 4.1.1-r3).
Compiled on a Linux >>2.6.19-rc6-mm2<< system on 2007-01-03.
Available extensions:
C stubs add-on version 2.1.2
crypt add-on version 2.1 by Michael Glad and others
Gentoo patchset 1.3
GNU Libidn by Simon Josefsson
GNU libio by Per Bothner
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Native POSIX Threads Library by Ulrich Drepper et al
Support for some architectures added on, not maintained in glibc core.
BIND-8.2.3-T5B
Thread-local storage support included. << 이부분이 보인다면 현재 glibc가 TLS를 지원하는버젼입니다.
For bug reporting instructions, please see:
.
__thread int i;
static __thread
extern __thread
__thread라는 storage clause를 통해서 TLS 변수임을 선언하고 사용하실 수 있습니다.
댓글 달기