...
1// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5#include <stddef.h>
6
7#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
8
9// Mingw seems not to have threads.h, so we use the _Thread_local keyword rather
10// than the thread_local macro.
11static _Thread_local int tls;
12
13const char *
14checkTLS() {
15 return NULL;
16}
17
18void
19setTLS(int v)
20{
21 tls = v;
22}
23
24int
25getTLS()
26{
27 return tls;
28}
29
30#else
31
32const char *
33checkTLS() {
34 return "_Thread_local requires C11 and not __STDC_NO_THREADS__";
35}
36
37void
38setTLS(int v) {
39}
40
41int
42getTLS()
43{
44 return 0;
45}
46
47#endif
View as plain text