14
14
* limitations under the License.
15
15
*/
16
16
17
- #ifndef _LIBS_CUTILS_THREADS_H
18
- #define _LIBS_CUTILS_THREADS_H
17
+ #pragma once
19
18
20
19
#include <sys/types.h>
21
20
29
28
extern "C" {
30
29
#endif
31
30
32
- //
33
- // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
34
- //
35
-
36
- extern pid_t gettid ();
37
-
38
- //
39
- // Deprecated: use `_Thread_local` in C or `thread_local` in C++.
40
- //
41
-
42
31
#if !defined(_WIN32 )
43
32
44
33
typedef struct {
@@ -49,29 +38,24 @@ typedef struct {
49
38
50
39
#define THREAD_STORE_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0 }
51
40
52
- #else // !defined(_WIN32)
53
-
54
- typedef struct {
55
- int lock_init ;
56
- int has_tls ;
57
- DWORD tls ;
58
- CRITICAL_SECTION lock ;
59
- } thread_store_t ;
60
-
61
- #define THREAD_STORE_INITIALIZER { 0, 0, 0, {0, 0, 0, 0, 0, 0} }
62
-
63
- #endif // !defined(_WIN32)
64
-
65
- typedef void (* thread_store_destruct_t )(void * value );
41
+ #endif
66
42
67
- extern void * thread_store_get (thread_store_t * store );
43
+ //
44
+ // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
45
+ //
46
+ extern pid_t gettid ();
68
47
69
- extern void thread_store_set (thread_store_t * store ,
70
- void * value ,
71
- thread_store_destruct_t destroy );
48
+ //
49
+ // Deprecated: use `_Thread_local` in C or `thread_local` in C++.
50
+ //
51
+ #if !defined(_WIN32 )
52
+ typedef void (* thread_store_destruct_t )(void * x );
53
+ extern void * thread_store_get (thread_store_t * x )
54
+ __attribute__((__deprecated__ ("use thread_local instead" )));
55
+ extern void thread_store_set (thread_store_t * x , void * y , thread_store_destruct_t z )
56
+ __attribute__((__deprecated__ ("use thread_local instead" )));
57
+ #endif
72
58
73
59
#ifdef __cplusplus
74
60
}
75
61
#endif
76
-
77
- #endif /* _LIBS_CUTILS_THREADS_H */
0 commit comments