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 /* | 7 /* |
8 * Native Client pthreads implementation layer | 8 * Native Client pthreads implementation layer |
9 */ | 9 */ |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 struct __nc_basic_thread_data; | 40 struct __nc_basic_thread_data; |
41 | 41 |
42 /* This struct defines the layout of the TDB */ | 42 /* This struct defines the layout of the TDB */ |
43 /* | 43 /* |
44 * NOTE: Based on a conversation with mcgrathr, unused_dtv was added to enable | 44 * NOTE: Based on a conversation with mcgrathr, unused_dtv was added to enable |
45 * experiments with newlib as a shared library talking to glibc's ld.so. | 45 * experiments with newlib as a shared library talking to glibc's ld.so. |
46 * ld.so does not mind if we trample over most of its tdb structure | 46 * ld.so does not mind if we trample over most of its tdb structure |
47 * ("tcbhead_t") as long as we keep the field "dtv" untouched and | 47 * ("tcbhead_t") as long as we keep the field "dtv" untouched and |
48 * use tls_base in a compatible way (which we already do). | 48 * use tls_base in a compatible way (which we already do). |
49 */ | 49 */ |
50 typedef struct nc_thread_descriptor { | 50 typedef struct { |
51 void *tls_base; /* tls accesses are made relative to this base */ | 51 void *tls_base; /* tls accesses are made relative to this base */ |
52 void *unused_dtv; /* increase compatibility with glibc's tcbhead_t */ | 52 void *unused_dtv; /* increase compatibility with glibc's tcbhead_t */ |
53 int joinable; | 53 int joinable; |
54 int join_waiting; | 54 int join_waiting; |
55 unsigned int rdlock_count; /* number of rdlocks this thread holds */ | |
56 nc_thread_memory_block_t *stack_node; | 55 nc_thread_memory_block_t *stack_node; |
57 nc_thread_memory_block_t *tls_node; | 56 nc_thread_memory_block_t *tls_node; |
58 nc_thread_function start_func; | 57 nc_thread_function start_func; |
59 void *state; | 58 void *state; |
60 /* | 59 /* |
61 * irt_thread_data is used when libpthread is linked into the IRT. | 60 * irt_thread_data is used when libpthread is linked into the IRT. |
62 * It is used for free()ing the thread block. | 61 * It is used for free()ing the thread block. |
63 * TODO(mseaborn): This plays a similar role to tls_node; the two | 62 * TODO(mseaborn): This plays a similar role to tls_node; the two |
64 * could be unified in future. | 63 * could be unified in future. |
65 */ | 64 */ |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 93 |
95 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { | 94 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { |
96 return &node[1]; | 95 return &node[1]; |
97 } | 96 } |
98 | 97 |
99 #ifdef __cplusplus | 98 #ifdef __cplusplus |
100 } | 99 } |
101 #endif | 100 #endif |
102 | 101 |
103 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ | 102 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ |
OLD | NEW |