Blame lib/gthreads.h

Packit aea12f
/*
Packit aea12f
 * Copyright (C) 2018 Red Hat, Inc.
Packit aea12f
 *
Packit aea12f
 * Author: Nikos Mavrogiannopoulos
Packit aea12f
 *
Packit aea12f
 * This file is part of GnuTLS.
Packit aea12f
 *
Packit aea12f
 * The GnuTLS is free software; you can redistribute it and/or
Packit aea12f
 * modify it under the terms of the GNU Lesser General Public License
Packit aea12f
 * as published by the Free Software Foundation; either version 2.1 of
Packit aea12f
 * the License, or (at your option) any later version.
Packit aea12f
 *
Packit aea12f
 * This library is distributed in the hope that it will be useful, but
Packit aea12f
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit aea12f
 * Lesser General Public License for more details.
Packit aea12f
 *
Packit aea12f
 * You should have received a copy of the GNU Lesser General Public License
Packit aea12f
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
Packit aea12f
 *
Packit aea12f
 */
Packit aea12f
Packit aea12f
#ifndef GNUTLS_LIB_GTHREADS_H
Packit aea12f
#define GNUTLS_LIB_GTHREADS_H
Packit aea12f
Packit aea12f
#include <config.h>
Packit aea12f
Packit aea12f
/* Using a C99-only compiler installed in parallel with modern C11 environment
Packit aea12f
 * will see HAVE_THREADS_H, but won't be able to use _Thread_local. */
Packit aea12f
#if __STDC_VERSION__ >= 201112 && !defined(__STDC_NO_THREADS__) && defined(HAVE_THREADS_H)
Packit aea12f
# include <threads.h>
Packit Service 991b93
#elif defined(__GNUC__) || defined(__SUNPRO_C) || defined(__xlC__) /* clang is covered by __GNUC__ */
Packit aea12f
# define _Thread_local __thread
Packit aea12f
#elif defined(_MSC_VER)
Packit aea12f
# define _Thread_local __declspec(thread)
Packit aea12f
#else
Packit aea12f
# error Unsupported platform
Packit aea12f
#endif
Packit aea12f
Packit aea12f
#endif /* GNUTLS_LIB_GTHREADS_H */