VMC Version 2.0
Loading...
Searching...
No Matches
TMCtls.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------
2// Copyright (C) 2019 CERN and copyright holders of VMC Project.
3// This software is distributed under the terms of the GNU General Public
4// License v3 (GPL Version 3), copied verbatim in the file "LICENSE".
5//
6// See https://github.com/vmc-project/vmc for full licensing information.
7// -----------------------------------------------------------------------
8
9// Author: Ivana Hrivnacova, 29/04/2014
10
11/*************************************************************************
12 * Copyright (C) 2014, Rene Brun and Fons Rademakers. *
13 * All rights reserved. *
14 * *
15 * For the licensing terms see $ROOTSYS/LICENSE. *
16 * For the list of contributors see $ROOTSYS/README/CREDITS. *
17 *************************************************************************/
18
19// clang-format off
20
21// ********************************************************************
22// * License and Disclaimer *
23// * *
24// * The Geant4 software is copyright of the Copyright Holders of *
25// * the Geant4 Collaboration. It is provided under the terms and *
26// * conditions of the Geant4 Software License, included in the file *
27// * LICENSE and available at http://cern.ch/geant4/license . These *
28// * include a list of copyright holders. *
29// * *
30// * Neither the authors of this software system, nor their employing *
31// * institutes,nor the agencies providing financial support for this *
32// * work make any representation or warranty, express or implied, *
33// * regarding this software system or assume any liability for its *
34// * use. Please see the license in the file LICENSE and URL above *
35// * for the full disclaimer and the limitation of liability. *
36// * *
37// * This code implementation is the result of the scientific and *
38// * technical work of the GEANT4 collaboration. *
39// * By using, copying, modifying or distributing the software (or *
40// * any work based on the software) you agree to acknowledge its *
41// * use in resulting scientific publications, and indicate your *
42// * acceptance of all terms of the Geant4 Software license. *
43// ********************************************************************
44
45#ifndef ROOT_TMCtls
46#define ROOT_TMCtls
47
48// Thread Local Storage typedefs
49//
50// According to Geant4 tls.hh and G4Threading.hh
51
52// Always build with thread support but keep a possibility to introduce
53// a build option
54#define VMC_MULTITHREADED 1
55
56# if defined(VMC_MULTITHREADED)
57# if(defined(__MACH__) && defined(__clang__)) || \
58 (defined(__linux__) && defined(__clang__))
59# define TMCThreadLocalStatic static thread_local
60# define TMCThreadLocal thread_local
61# elif((defined(__linux__) || defined(__MACH__)) && \
62 !defined(__INTEL_COMPILER) && defined(__GNUC__) && \
63 (__GNUC__ >= 4 && __GNUC_MINOR__ < 9))
64# define TMCThreadLocalStatic static __thread
65# define TMCThreadLocal thread_local
66# elif((defined(__linux__) || defined(__MACH__)) && \
67 !defined(__INTEL_COMPILER) && defined(__GNUC__) && \
68 (__GNUC__ >= 4 && __GNUC_MINOR__ >= 9) || \
69 __GNUC__ >= 5)
70# define TMCThreadLocalStatic static thread_local
71# define TMCThreadLocal thread_local
72# elif((defined(__linux__) || defined(__MACH__)) && \
73 defined(__INTEL_COMPILER))
74# if __INTEL_COMPILER >= 1500
75# define TMCThreadLocalStatic static thread_local
76# define TMCThreadLocal thread_local
77# else
78# define TMCThreadLocalStatic static __thread
79# define TMCThreadLocal __thread
80# endif
81# elif defined(_AIX)
82# define TMCThreadLocalStatic static thread_local
83# define TMCThreadLocal thread_local
84# elif defined(WIN32)
85# define TMCThreadLocalStatic static thread_local
86# define TMCThreadLocal thread_local
87# else
88# error \
89 "No Thread Local Storage (TLS) technology supported for this platform. Use sequential build !"
90# endif
91# else
92# define TMCThreadLocalStatic static
93# define TMCThreadLocal
94# endif
95
96#endif //ROOT_TMCtls