Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/glthread/tls.c @ 14079:97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Run the new "make update-copyright" rule.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sat, 01 Jan 2011 20:17:23 +0100 (2011-01-01) |
parents | c2cbabec01dd |
children | 8250f2777afc |
rev | line source |
---|---|
10318
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Thread-local storage in multithreaded situations. |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
2 Copyright (C) 2005-2011 Free Software Foundation, Inc. |
10318
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 #include <config.h> |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 #include "glthread/tls.h" |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 /* ========================================================================= */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 #if USE_POSIX_THREADS |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 #endif |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 /* ========================================================================= */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 #if USE_PTH_THREADS |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 #endif |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 /* ========================================================================= */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 #if USE_SOLARIS_THREADS |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 /* Use the old Solaris threads library. */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 /* ------------------------- gl_tls_key_t datatype ------------------------- */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 void * |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 glthread_tls_get_multithreaded (thread_key_t key) |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 { |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 void *value; |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 if (thr_getspecific (key, &value) != 0) |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 abort (); |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 return value; |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 } |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 #endif |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 /* ========================================================================= */ |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 #if USE_WIN32_THREADS |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 #endif |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 |
8a3539888308
Move the lock and tls source files into a subdirectory.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 /* ========================================================================= */ |