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 { | 50 typedef struct nc_thread_descriptor { |
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 */ |
55 nc_thread_memory_block_t *stack_node; | 56 nc_thread_memory_block_t *stack_node; |
56 nc_thread_memory_block_t *tls_node; | 57 nc_thread_memory_block_t *tls_node; |
57 nc_thread_function start_func; | 58 nc_thread_function start_func; |
58 void *state; | 59 void *state; |
59 /* | 60 /* |
60 * irt_thread_data is used when libpthread is linked into the IRT. | 61 * irt_thread_data is used when libpthread is linked into the IRT. |
61 * It is used for free()ing the thread block. | 62 * It is used for free()ing the thread block. |
62 * TODO(mseaborn): This plays a similar role to tls_node; the two | 63 * TODO(mseaborn): This plays a similar role to tls_node; the two |
63 * could be unified in future. | 64 * could be unified in future. |
64 */ | 65 */ |
(...skipping 28 matching lines...) Expand all Loading... |
93 | 94 |
94 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { | 95 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { |
95 return &node[1]; | 96 return &node[1]; |
96 } | 97 } |
97 | 98 |
98 #ifdef __cplusplus | 99 #ifdef __cplusplus |
99 } | 100 } |
100 #endif | 101 #endif |
101 | 102 |
102 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ | 103 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ |
OLD | NEW |