| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void *irt_thread_data; | 66 void *irt_thread_data; |
| 67 struct __nc_basic_thread_data *basic_data; | 67 struct __nc_basic_thread_data *basic_data; |
| 68 } nc_thread_descriptor_t; | 68 } nc_thread_descriptor_t; |
| 69 | 69 |
| 70 typedef struct __nc_basic_thread_data { | 70 typedef struct __nc_basic_thread_data { |
| 71 void *retval; | 71 void *retval; |
| 72 nc_thread_status_t status; | 72 nc_thread_status_t status; |
| 73 pthread_cond_t join_condvar; | 73 pthread_cond_t join_condvar; |
| 74 /* Pointer to the tdb, will be null after the thread terminates. */ | 74 /* Pointer to the tdb, will be null after the thread terminates. */ |
| 75 nc_thread_descriptor_t *tdb; | 75 nc_thread_descriptor_t *tdb; |
| 76 pid_t native_tid; |
| 76 } nc_basic_thread_data_t; | 77 } nc_basic_thread_data_t; |
| 77 | 78 |
| 78 /* | 79 /* |
| 79 * This structure is allocated for all threads. However, for threads | 80 * This structure is allocated for all threads. However, for threads |
| 80 * created with pthread_create(), the basic_data field is not used, | 81 * created with pthread_create(), the basic_data field is not used, |
| 81 * and a separate nc_basic_thread_data_t struct is allocated. The | 82 * and a separate nc_basic_thread_data_t struct is allocated. The |
| 82 * initial thread, and threads created by the IRT's thread_create() | 83 * initial thread, and threads created by the IRT's thread_create() |
| 83 * interface, do use the basic_data field though. | 84 * interface, do use the basic_data field though. |
| 84 * TODO(mseaborn): Clean this up to be more consistent. | 85 * TODO(mseaborn): Clean this up to be more consistent. |
| 85 */ | 86 */ |
| 86 struct nc_combined_tdb { | 87 struct nc_combined_tdb { |
| 87 nc_thread_descriptor_t tdb; | 88 nc_thread_descriptor_t tdb; |
| 88 nc_basic_thread_data_t basic_data; | 89 nc_basic_thread_data_t basic_data; |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 | 92 |
| 92 #define MEMORY_BLOCK_ALLOCATION_SIZE(real_size) \ | 93 #define MEMORY_BLOCK_ALLOCATION_SIZE(real_size) \ |
| 93 (sizeof(nc_thread_memory_block_t) + (real_size)) | 94 (sizeof(nc_thread_memory_block_t) + (real_size)) |
| 94 | 95 |
| 95 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { | 96 static inline void *nc_memory_block_to_payload(nc_thread_memory_block_t *node) { |
| 96 return &node[1]; | 97 return &node[1]; |
| 97 } | 98 } |
| 98 | 99 |
| 99 #ifdef __cplusplus | 100 #ifdef __cplusplus |
| 100 } | 101 } |
| 101 #endif | 102 #endif |
| 102 | 103 |
| 103 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ | 104 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_NC_PTHREAD_TYPES_H_ */ |
| OLD | NEW |