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 // Used to temporarily disable or enable thread interrupts. |
| 375 void DisableThreadInterrupts(); |
| 376 void EnableThreadInterrupts(); |
| 377 bool ThreadInterruptsEnabled(); |
| 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 26 matching lines...) Expand all Loading... |
410 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 415 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
411 | 416 |
412 private: | 417 private: |
413 template<class T> T* AllocateReusableHandle(); | 418 template<class T> T* AllocateReusableHandle(); |
414 | 419 |
415 static ThreadLocalKey thread_key_; | 420 static ThreadLocalKey thread_key_; |
416 | 421 |
417 const ThreadId id_; | 422 const ThreadId id_; |
418 ThreadInterruptCallback thread_interrupt_callback_; | 423 ThreadInterruptCallback thread_interrupt_callback_; |
419 void* thread_interrupt_data_; | 424 void* thread_interrupt_data_; |
| 425 uintptr_t thread_interrupt_disabled_; |
420 Isolate* isolate_; | 426 Isolate* isolate_; |
421 Heap* heap_; | 427 Heap* heap_; |
422 State state_; | 428 State state_; |
423 Mutex timeline_block_lock_; | 429 Mutex timeline_block_lock_; |
424 TimelineEventBlock* timeline_block_; | 430 TimelineEventBlock* timeline_block_; |
425 StoreBufferBlock* store_buffer_block_; | 431 StoreBufferBlock* store_buffer_block_; |
426 class Log* log_; | 432 class Log* log_; |
427 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ | 433 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ |
428 type_name member_name; | 434 type_name member_name; |
429 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) | 435 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 }; | 534 }; |
529 | 535 |
530 #if defined(TARGET_OS_WINDOWS) | 536 #if defined(TARGET_OS_WINDOWS) |
531 // Clears the state of the current thread and frees the allocation. | 537 // Clears the state of the current thread and frees the allocation. |
532 void WindowsThreadCleanUp(); | 538 void WindowsThreadCleanUp(); |
533 #endif | 539 #endif |
534 | 540 |
535 } // namespace dart | 541 } // namespace dart |
536 | 542 |
537 #endif // VM_THREAD_H_ | 543 #endif // VM_THREAD_H_ |
OLD | NEW |