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" |
11 #include "native_client/src/untrusted/pthread/pthread.h" | 13 #include "native_client/src/untrusted/pthread/pthread.h" |
| 14 #include "native_client/src/untrusted/pthread/pthread_types.h" |
12 | 15 |
13 struct nc_combined_tdb; | 16 #define TDB_SIZE (sizeof(struct nc_combined_tdb)) |
14 | 17 |
15 extern int __nc_thread_initialized; | 18 extern int __nc_thread_initialized; |
16 extern pthread_t __nc_initial_thread_id; | 19 extern pthread_t __nc_initial_thread_id; |
17 | 20 |
18 void __nc_initialize_globals(void); | 21 void __nc_initialize_globals(void); |
19 | 22 |
20 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb); | 23 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb); |
21 | 24 |
22 void __nc_initialize_interfaces(void); | 25 void __nc_initialize_interfaces(void); |
23 | 26 |
24 void __nc_tsd_exit(void); | 27 void __nc_tsd_exit(void); |
25 | 28 |
| 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 |
26 #endif | 39 #endif |
OLD | NEW |