Index: runtime/vm/isolate.h |
=================================================================== |
--- runtime/vm/isolate.h (revision 21380) |
+++ runtime/vm/isolate.h (working copy) |
@@ -273,6 +273,11 @@ |
kVmStatusInterrupt, |
}; |
+ enum { |
Ivan Posva
2013/04/12 21:23:03
Please name this enum.
Tom Ball
2013/04/12 21:56:47
Done.
|
+ kIsolateWaiting = 0x1, // The isolate is waiting for code to execute. |
Ivan Posva
2013/04/12 21:23:03
= 0
Tom Ball
2013/04/12 21:56:47
Done.
|
+ kIsolateRunning = 0x2, // The isolate is executing code. |
Ivan Posva
2013/04/12 21:23:03
We do not necessarily care about this absolute val
Tom Ball
2013/04/12 21:56:47
Done.
|
+ }; |
+ |
void ScheduleInterrupts(uword interrupt_bits); |
uword GetAndClearInterrupts(); |
@@ -285,6 +290,9 @@ |
bool is_runnable() const { return is_runnable_; } |
void set_is_runnable(bool value) { is_runnable_ = value; } |
+ uword running_state() const { return running_state_; } |
Ivan Posva
2013/04/12 21:23:03
Once the enum is name we do not have to pass uword
Tom Ball
2013/04/12 21:56:47
Done.
|
+ void set_running_state(uword value) { running_state_ = value; } |
+ |
uword spawn_data() const { return spawn_data_; } |
void set_spawn_data(uword value) { spawn_data_ = value; } |
@@ -492,6 +500,7 @@ |
MessageHandler* message_handler_; |
uword spawn_data_; |
bool is_runnable_; |
Ivan Posva
2013/04/12 21:23:03
What is the difference to this field? Shouldn't th
Tom Ball
2013/04/12 21:56:47
I found that a client can invoke multiple function
|
+ uword running_state_; |
GcPrologueCallbacks gc_prologue_callbacks_; |
GcEpilogueCallbacks gc_epilogue_callbacks_; |
@@ -607,6 +616,28 @@ |
char* exception_callback_name_; |
}; |
+ |
+class IsolateRunStateManager : public StackResource { |
+ public: |
+ explicit IsolateRunStateManager() |
+ : StackResource(Isolate::Current()), saved_state_(0) { |
+ saved_state_ = reinterpret_cast<Isolate*>(isolate())->running_state(); |
+ } |
+ |
+ virtual ~IsolateRunStateManager() { |
+ reinterpret_cast<Isolate*>(isolate())->set_running_state(saved_state_); |
+ } |
+ |
+ void SetRunState(uword run_state) { |
+ reinterpret_cast<Isolate*>(isolate())->set_running_state(run_state); |
+ } |
+ |
+ private: |
+ uword saved_state_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(IsolateRunStateManager); |
+}; |
+ |
} // namespace dart |
#endif // VM_ISOLATE_H_ |