OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_THREAD_H_ | 5 #ifndef VM_THREAD_H_ |
6 #define VM_THREAD_H_ | 6 #define VM_THREAD_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 static intptr_t vm_tag_offset() { | 365 static intptr_t vm_tag_offset() { |
366 return OFFSET_OF(Thread, vm_tag_); | 366 return OFFSET_OF(Thread, vm_tag_); |
367 } | 367 } |
368 | 368 |
369 ThreadId id() const { | 369 ThreadId id() const { |
370 ASSERT(id_ != OSThread::kInvalidThreadId); | 370 ASSERT(id_ != OSThread::kInvalidThreadId); |
371 return id_; | 371 return id_; |
372 } | 372 } |
373 | 373 |
| 374 ThreadId join_id() const { |
| 375 ASSERT(join_id_ != OSThread::kInvalidThreadJoinId); |
| 376 return join_id_; |
| 377 } |
| 378 |
374 void SetThreadInterrupter(ThreadInterruptCallback callback, void* data); | 379 void SetThreadInterrupter(ThreadInterruptCallback callback, void* data); |
375 | 380 |
376 bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback, | 381 bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback, |
377 void** data) const; | 382 void** data) const; |
378 | 383 |
379 #if defined(DEBUG) | 384 #if defined(DEBUG) |
380 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ | 385 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ |
381 void set_reusable_##object##_handle_scope_active(bool value) { \ | 386 void set_reusable_##object##_handle_scope_active(bool value) { \ |
382 reusable_##object##_handle_scope_active_ = value; \ | 387 reusable_##object##_handle_scope_active_ = value; \ |
383 } \ | 388 } \ |
(...skipping 18 matching lines...) Expand all Loading... |
402 object& object##Handle() const { \ | 407 object& object##Handle() const { \ |
403 return *object##_handle_; \ | 408 return *object##_handle_; \ |
404 } | 409 } |
405 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) | 410 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) |
406 #undef REUSABLE_HANDLE | 411 #undef REUSABLE_HANDLE |
407 | 412 |
408 RawGrowableObjectArray* pending_functions(); | 413 RawGrowableObjectArray* pending_functions(); |
409 | 414 |
410 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 415 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
411 | 416 |
| 417 static bool IsThreadInList(ThreadId join_id); |
| 418 |
412 private: | 419 private: |
413 template<class T> T* AllocateReusableHandle(); | 420 template<class T> T* AllocateReusableHandle(); |
414 | 421 |
415 static ThreadLocalKey thread_key_; | 422 static ThreadLocalKey thread_key_; |
416 | 423 |
417 const ThreadId id_; | 424 const ThreadId id_; |
| 425 const ThreadId join_id_; |
418 ThreadInterruptCallback thread_interrupt_callback_; | 426 ThreadInterruptCallback thread_interrupt_callback_; |
419 void* thread_interrupt_data_; | 427 void* thread_interrupt_data_; |
420 Isolate* isolate_; | 428 Isolate* isolate_; |
421 Heap* heap_; | 429 Heap* heap_; |
422 State state_; | 430 State state_; |
423 Mutex timeline_block_lock_; | 431 Mutex timeline_block_lock_; |
424 TimelineEventBlock* timeline_block_; | 432 TimelineEventBlock* timeline_block_; |
425 StoreBufferBlock* store_buffer_block_; | 433 StoreBufferBlock* store_buffer_block_; |
426 class Log* log_; | 434 class Log* log_; |
427 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ | 435 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 }; | 537 }; |
530 | 538 |
531 #if defined(TARGET_OS_WINDOWS) | 539 #if defined(TARGET_OS_WINDOWS) |
532 // Clears the state of the current thread and frees the allocation. | 540 // Clears the state of the current thread and frees the allocation. |
533 void WindowsThreadCleanUp(); | 541 void WindowsThreadCleanUp(); |
534 #endif | 542 #endif |
535 | 543 |
536 } // namespace dart | 544 } // namespace dart |
537 | 545 |
538 #endif // VM_THREAD_H_ | 546 #endif // VM_THREAD_H_ |
OLD | NEW |