(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / linuxthreads / sysdeps / pthread / bits / libc-tsd.h
blobfa6eb4be28e6f3f5f67fad83021abb5eba398f42
1 /* libc-internal interface for thread-specific data. LinuxThreads version.
2 Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _BITS_LIBC_TSD_H
21 #define _BITS_LIBC_TSD_H 1
23 #include <linuxthreads/descr.h>
24 #include <tls.h>
26 #if USE_TLS && HAVE___THREAD
28 /* When __thread works, the generic definition is what we want. */
29 # include <sysdeps/generic/bits/libc-tsd.h>
31 #else
33 # include <bits/libc-lock.h>
35 # ifndef SHARED
36 extern void ** __pthread_internal_tsd_address (int);
37 extern void *__pthread_internal_tsd_get (int);
38 extern int __pthread_internal_tsd_set (int, const void *);
40 weak_extern (__pthread_internal_tsd_address)
41 weak_extern (__pthread_internal_tsd_get)
42 weak_extern (__pthread_internal_tsd_set)
43 # endif
45 #define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
46 #define __libc_tsd_address(KEY) \
47 __libc_maybe_call2 (pthread_internal_tsd_address, \
48 (_LIBC_TSD_KEY_##KEY), &__libc_tsd_##KEY##_data)
49 #define __libc_tsd_get(KEY) \
50 __libc_maybe_call2 (pthread_internal_tsd_get, \
51 (_LIBC_TSD_KEY_##KEY), __libc_tsd_##KEY##_data)
52 #define __libc_tsd_set(KEY, VALUE) \
53 __libc_maybe_call2 (pthread_internal_tsd_set, \
54 (_LIBC_TSD_KEY_##KEY, (VALUE)), \
55 (__libc_tsd_##KEY##_data = (VALUE), 0))
57 #endif
59 #endif /* bits/libc-tsd.h */