rev |
line source |
alpar@9
|
1 /* glpenv02.c (thread local storage) */
|
alpar@9
|
2
|
alpar@9
|
3 /***********************************************************************
|
alpar@9
|
4 * This code is part of GLPK (GNU Linear Programming Kit).
|
alpar@9
|
5 *
|
alpar@9
|
6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
alpar@9
|
7 * 2009, 2010, 2011 Andrew Makhorin, Department for Applied Informatics,
|
alpar@9
|
8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
|
alpar@9
|
9 * E-mail: <mao@gnu.org>.
|
alpar@9
|
10 *
|
alpar@9
|
11 * GLPK is free software: you can redistribute it and/or modify it
|
alpar@9
|
12 * under the terms of the GNU General Public License as published by
|
alpar@9
|
13 * the Free Software Foundation, either version 3 of the License, or
|
alpar@9
|
14 * (at your option) any later version.
|
alpar@9
|
15 *
|
alpar@9
|
16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
|
alpar@9
|
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
alpar@9
|
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
alpar@9
|
19 * License for more details.
|
alpar@9
|
20 *
|
alpar@9
|
21 * You should have received a copy of the GNU General Public License
|
alpar@9
|
22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
|
alpar@9
|
23 ***********************************************************************/
|
alpar@9
|
24
|
alpar@9
|
25 #include "glpenv.h"
|
alpar@9
|
26
|
alpar@9
|
27 static void *tls = NULL;
|
alpar@9
|
28 /* in a re-entrant version of the package this variable must be placed
|
alpar@9
|
29 in the Thread Local Storage (TLS) */
|
alpar@9
|
30
|
alpar@9
|
31 /***********************************************************************
|
alpar@9
|
32 * NAME
|
alpar@9
|
33 *
|
alpar@9
|
34 * tls_set_ptr - store global pointer in TLS
|
alpar@9
|
35 *
|
alpar@9
|
36 * SYNOPSIS
|
alpar@9
|
37 *
|
alpar@9
|
38 * #include "glpenv.h"
|
alpar@9
|
39 * void tls_set_ptr(void *ptr);
|
alpar@9
|
40 *
|
alpar@9
|
41 * DESCRIPTION
|
alpar@9
|
42 *
|
alpar@9
|
43 * The routine tls_set_ptr stores a pointer specified by the parameter
|
alpar@9
|
44 * ptr in the Thread Local Storage (TLS). */
|
alpar@9
|
45
|
alpar@9
|
46 void tls_set_ptr(void *ptr)
|
alpar@9
|
47 { tls = ptr;
|
alpar@9
|
48 return;
|
alpar@9
|
49 }
|
alpar@9
|
50
|
alpar@9
|
51 /***********************************************************************
|
alpar@9
|
52 * NAME
|
alpar@9
|
53 *
|
alpar@9
|
54 * tls_get_ptr - retrieve global pointer from TLS
|
alpar@9
|
55 *
|
alpar@9
|
56 * SYNOPSIS
|
alpar@9
|
57 *
|
alpar@9
|
58 * #include "glpenv.h"
|
alpar@9
|
59 * void *tls_get_ptr(void);
|
alpar@9
|
60 *
|
alpar@9
|
61 * RETURNS
|
alpar@9
|
62 *
|
alpar@9
|
63 * The routine tls_get_ptr returns a pointer previously stored by the
|
alpar@9
|
64 * routine tls_set_ptr. If the latter has not been called yet, NULL is
|
alpar@9
|
65 * returned. */
|
alpar@9
|
66
|
alpar@9
|
67 void *tls_get_ptr(void)
|
alpar@9
|
68 { void *ptr;
|
alpar@9
|
69 ptr = tls;
|
alpar@9
|
70 return ptr;
|
alpar@9
|
71 }
|
alpar@9
|
72
|
alpar@9
|
73 /* eof */
|