COIN-OR::LEMON - Graph Library

source: glpk-cmake/src/glpenv02.c @ 2:4c8956a7bdf4

Last change on this file since 2:4c8956a7bdf4 was 1:c445c931472f, checked in by Alpar Juttner <alpar@…>, 14 years ago

Import glpk-4.45

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