| Index: src/v8threads.h | 
| diff --git a/src/v8threads.h b/src/v8threads.h | 
| index 06840532812ee9133e1d8160a14492e64d9d04db..9fa6f0eaf91f8ec3e61914e5b5926e0fda077dea 100644 | 
| --- a/src/v8threads.h | 
| +++ b/src/v8threads.h | 
| @@ -29,6 +29,11 @@ | 
| #define V8_V8THREADS_H_ | 
|  | 
| namespace v8 { | 
| + | 
| +struct LockParameters { | 
| +  bool successfully_relaied; | 
| +}; | 
| + | 
| namespace internal { | 
|  | 
|  | 
| @@ -78,12 +83,43 @@ class ThreadState { | 
| static ThreadState* in_use_anchor_; | 
| }; | 
|  | 
| +#ifdef ENABLE_DEBUGGER_SUPPORT | 
| + | 
| +struct Promises { | 
| +  bool promise_to_process_debug_commands; | 
| +  void Reset() { | 
| +    promise_to_process_debug_commands = false; | 
| +  } | 
| +}; | 
| + | 
| +// This mutex has an additional feature: you may try acquire it if it's free or | 
| +// ASK someone who owns it right now to do a particular chore for you before | 
| +// releasing it. The current owner is guaranteed to NOTICE your ask. | 
| +class MutexWithResponsibilities { | 
| + public: | 
| +  MutexWithResponsibilities(); | 
| +  ~MutexWithResponsibilities(); | 
| +  void Lock(); | 
| +  bool LockOrAsk(bool Promises::* promise); | 
| +  void Unlock(); | 
| + | 
| + private: | 
| +  Mutex* flag_mutex_; | 
| +  Semaphore* sem_; | 
| +  bool locked_; | 
| +  bool has_promises_; | 
| +  Promises promises_; | 
| +}; | 
| +#endif | 
|  | 
| class ThreadManager : public AllStatic { | 
| public: | 
| static void Lock(); | 
| static void Unlock(); | 
|  | 
| +#ifdef ENABLE_DEBUGGER_SUPPORT | 
| +  static bool LockOrAsk(bool Promises::* promise); | 
| +#endif | 
| static void ArchiveThread(); | 
| static bool RestoreThread(); | 
| static void FreeThreadResources(); | 
| @@ -105,7 +141,11 @@ class ThreadManager : public AllStatic { | 
| static void EagerlyArchiveThread(); | 
|  | 
| static int last_id_;  // V8 threads are identified through an integer. | 
| +#ifdef ENABLE_DEBUGGER_SUPPORT | 
| +  static MutexWithResponsibilities* mutex_; | 
| +#else | 
| static Mutex* mutex_; | 
| +#endif | 
| static ThreadHandle mutex_owner_; | 
| static ThreadHandle lazily_archived_thread_; | 
| static ThreadState* lazily_archived_thread_state_; | 
|  |