Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mono-tls.c « utils « mono - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 890f0782d57b45ab33385e1f64204c39b3bc7577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * mono-tls.c: Low-level TLS support
 *
 * Copyright 2013 Xamarin, Inc (http://www.xamarin.com)
 */

#include "mono-tls.h"

static int tls_offsets [TLS_KEY_NUM];
static gboolean tls_offset_set [TLS_KEY_NUM];

/*
 * mono_tls_key_get_offset:
 *
 *   Return the TLS offset used by the TLS var identified by KEY, previously initialized by a call to
 * mono_tls_key_set_offset (). Return -1 if the offset is not known.
 */
int
mono_tls_key_get_offset (MonoTlsKey key)
{
	g_assert (tls_offset_set [key]);
	return tls_offsets [key];
}

/*
 * mono_tls_key_set_offset:
 *
 *   Set the TLS offset used by the TLS var identified by KEY.
 */
void
mono_tls_key_set_offset (MonoTlsKey key, int offset)
{
	tls_offsets [key] = offset;
	tls_offset_set [key] = TRUE;
}