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 threads library | 8 * Native Client threads library |
9 */ | 9 */ |
10 | 10 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 ANNOTATE_NOT_HAPPENS_BEFORE_MUTEX(&__nc_thread_management_lock); | 265 ANNOTATE_NOT_HAPPENS_BEFORE_MUTEX(&__nc_thread_management_lock); |
266 | 266 |
267 if (pthread_cond_init(&__nc_last_thread_cond, NULL) != 0) | 267 if (pthread_cond_init(&__nc_last_thread_cond, NULL) != 0) |
268 __builtin_trap(); | 268 __builtin_trap(); |
269 STAILQ_INIT(&__nc_thread_memory_blocks[0]); | 269 STAILQ_INIT(&__nc_thread_memory_blocks[0]); |
270 STAILQ_INIT(&__nc_thread_memory_blocks[1]); | 270 STAILQ_INIT(&__nc_thread_memory_blocks[1]); |
271 | 271 |
272 __nc_thread_initialized = 1; | 272 __nc_thread_initialized = 1; |
273 } | 273 } |
274 | 274 |
275 #if defined(NACL_IN_IRT) | |
276 | |
277 /* | 275 /* |
278 * This is used by the IRT for user threads. We initialize all fields | 276 * This is used by the IRT for user threads. We initialize all fields |
279 * so that we get predictable behaviour in case some IRT code does an | 277 * so that we get predictable behaviour in case some IRT code does an |
280 * unsupported pthread operation on a user thread. | 278 * unsupported pthread operation on a user thread. |
281 */ | 279 */ |
282 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb) { | 280 void __nc_initialize_unjoinable_thread(struct nc_combined_tdb *tdb) { |
283 nc_tdb_init(&tdb->tdb, &tdb->basic_data); | 281 nc_tdb_init(&tdb->tdb, &tdb->basic_data); |
284 tdb->tdb.joinable = 0; | 282 tdb->tdb.joinable = 0; |
285 } | 283 } |
286 | 284 |
287 #else | 285 #if !defined(NACL_IN_IRT) |
288 | 286 |
289 /* | 287 /* |
290 * Will be called from the library startup code, | 288 * Will be called from the library startup code, |
291 * which always happens on the application's main thread. | 289 * which always happens on the application's main thread. |
292 */ | 290 */ |
293 void __pthread_initialize(void) { | 291 void __pthread_initialize(void) { |
294 __pthread_initialize_minimal(TDB_SIZE); | 292 __pthread_initialize_minimal(TDB_SIZE); |
295 | 293 |
296 struct nc_combined_tdb *tdb = (struct nc_combined_tdb *) __nc_get_tdb(); | 294 struct nc_combined_tdb *tdb = (struct nc_combined_tdb *) __nc_get_tdb(); |
297 nc_tdb_init(&tdb->tdb, &tdb->basic_data); | 295 nc_tdb_init(&tdb->tdb, &tdb->basic_data); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 808 |
811 /* | 809 /* |
812 * We include this directly in this file rather than compiling it | 810 * We include this directly in this file rather than compiling it |
813 * separately because there is some code (e.g. libstdc++) that uses weak | 811 * separately because there is some code (e.g. libstdc++) that uses weak |
814 * references to all pthread functions, but conditionalizes its calls only | 812 * references to all pthread functions, but conditionalizes its calls only |
815 * on one symbol. So if these functions are in another file in a library | 813 * on one symbol. So if these functions are in another file in a library |
816 * archive, they might not be linked in by static linking. | 814 * archive, they might not be linked in by static linking. |
817 */ | 815 */ |
818 /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ | 816 /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ |
819 #include "native_client/src/untrusted/pthread/nc_tsd.c" | 817 #include "native_client/src/untrusted/pthread/nc_tsd.c" |
OLD | NEW |