grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mesa / src / aros / tls.h
blob8056f01f32938e966891244bef24db0b4f1c0773
1 /*
2 Copyright 2010-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef TLS_H
7 #define TLS_H
9 #include <exec/types.h>
10 #include <aros/symbolsets.h>
12 struct TaskLocalStorage;
14 struct TaskLocalStorage * CreateTLS();
15 VOID InsertIntoTLS(struct TaskLocalStorage * tls, APTR ptr);
16 APTR GetFromTLS(struct TaskLocalStorage * tls);
17 VOID ClearFromTLS(struct TaskLocalStorage * tls);
18 VOID DestroyTLS(struct TaskLocalStorage * tls);
20 #define DECLARE_STATIC_TLS(tls) \
21 static struct TaskLocalStorage * tls = NULL; \
22 static LONG auto_create_##tls() \
23 { \
24 tls = CreateTLS(); \
25 if (tls) \
26 return 1; \
27 else \
28 return 0; \
29 } \
31 static VOID auto_destroy_##tls() \
32 { \
33 if (tls) \
34 DestroyTLS(tls); \
35 } \
36 ADD2INIT(auto_create_##tls, 5); \
37 ADD2EXIT(auto_destroy_##tls, 5);
39 #endif /* TLS_H */