Update.
[glibc.git] / bits / libc-tsd.h
blobc9a246f6fc360414d558f758d5d9dbcd335fc9d5
1 /* libc-internal interface for thread-specific data. Stub version.
2 Copyright (C) 1998, 2001 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library 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 /* This file defines the following macros for accessing a small fixed
24 set of thread-specific `void *' data used only internally by libc.
26 __libc_tsd_define(CLASS, KEY) -- Define or declare a `void *' datum
27 for KEY. CLASS can be `static' for
28 keys used in only one source file,
29 empty for global definitions, or
30 `extern' for global declarations.
31 __libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
32 __libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
34 The set of available KEY's will usually be provided as an enum,
35 and contains (at least):
36 _LIBC_TSD_KEY_MALLOC
37 _LIBC_TSD_KEY_DL_ERROR
38 _LIBC_TSD_KEY_RPC_VARS
39 All uses must be the literal _LIBC_TSD_* name in the __libc_tsd_* macros.
40 Some implementations may not provide any enum at all and instead
41 using string pasting in the macros. */
43 /* This is the generic/stub implementation for wholly single-threaded
44 systems. We don't define an enum for the possible key values, because
45 the KEYs translate directly into variables by macro magic. */
47 #define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
48 #define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
49 #define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
52 #endif /* bits/libc-tsd.h */