Chromium Code Reviews| Index: src/v8threads.h |
| =================================================================== |
| --- src/v8threads.h (revision 981) |
| +++ src/v8threads.h (working copy) |
| @@ -87,19 +87,31 @@ |
| }; |
| +// The ContextSwitcher thread is used to schedule regular preemptions to |
| +// multiple running V8 threads. Generally it is needed to call StartPreemption |
|
Erik Corry
2008/12/17 14:30:07
"it is necessary"
iposva
2008/12/17 17:39:24
Done.
|
| +// if there is more than one thread running. If not a single JavaScript can |
|
Erik Corry
2008/12/17 14:30:07
"If not, a single JavaScript thread can"
iposva
2008/12/17 17:39:24
Done.
|
| +// take full control of V8 and not allow other threads to run. |
| class ContextSwitcher: public Thread { |
| public: |
| - void Run(); |
| + // Set the preemption interval for the ContextSwitcher thread. |
| static void StartPreemption(int every_n_ms); |
| + |
| + // Stop sending preemption requests to threads. |
| static void StopPreemption(); |
| + |
| + // Preempted thread needs to calls back to the ContextSwitcher to acknowlege |
|
Erik Corry
2008/12/17 14:30:07
"to call back"
iposva
2008/12/17 17:39:24
Done.
|
| + // the handling of a preemption request. |
| static void PreemptionReceived(); |
| + |
| private: |
| explicit ContextSwitcher(int every_n_ms); |
| - void WaitForPreemption(); |
| - void Stop(); |
| - Semaphore* preemption_semaphore_; |
| + |
| + void Run(); |
| + |
| bool keep_going_; |
| int sleep_ms_; |
| + |
| + static ContextSwitcher* singleton_; |
| }; |
| } } // namespace v8::internal |