OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_PTHREAD_INTERNAL_H_ | 7 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_PTHREAD_INTERNAL_H_ |
8 #define NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_PTHREAD_INTERNAL_H_ 1 | 8 #define NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_PTHREAD_INTERNAL_H_ 1 |
9 | 9 |
10 #include "native_client/src/untrusted/irt/irt.h" | 10 #include "native_client/src/untrusted/irt/irt.h" |
11 #include "native_client/src/untrusted/nacl/tls.h" | |
12 #include "native_client/src/untrusted/nacl/tls_params.h" | |
13 #include "native_client/src/untrusted/pthread/pthread.h" | 11 #include "native_client/src/untrusted/pthread/pthread.h" |
14 #include "native_client/src/untrusted/pthread/pthread_types.h" | |
15 | 12 |
16 #define TDB_SIZE (sizeof(struct nc_combined_tdb)) | 13 struct nc_combined_tdb; |
17 | 14 |
18 extern int __nc_thread_initialized; | 15 extern int __nc_thread_initialized; |
19 extern pthread_t __nc_initial_thread_id; | 16 extern pthread_t __nc_initial_thread_id; |
20 | 17 |
21 void __nc_initialize_globals(void); | 18 void __nc_initialize_globals(void); |
22 | 19 |
23 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb); | 20 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb); |
24 | 21 |
25 void __nc_initialize_interfaces(void); | 22 void __nc_initialize_interfaces(void); |
26 | 23 |
27 void __nc_tsd_exit(void); | 24 void __nc_tsd_exit(void); |
28 | 25 |
29 static inline struct nc_thread_descriptor *__nc_get_tdb(void) { | |
30 /* | |
31 * Fetch the thread-specific data pointer. This is usually just | |
32 * a wrapper around __libnacl_irt_tls.tls_get() but we don't use | |
33 * that here so that the IRT build can override the definition. | |
34 */ | |
35 return (void *) ((char *) __nacl_read_tp_inline() | |
36 + __nacl_tp_tdb_offset(TDB_SIZE)); | |
37 } | |
38 | |
39 #endif | 26 #endif |
OLD | NEW |