Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Unified Diff: src/v8threads.h

Issue 14892: Merge changes from bleeding_edge into experimental toiger branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | src/v8threads.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8threads.h
===================================================================
--- src/v8threads.h (revision 1012)
+++ 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 necessary to call
+// StartPreemption if there is more than one thread running. If not, a single
+// JavaScript can 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 call back to the ContextSwitcher to acknowlege
+ // 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
« no previous file with comments | « src/runtime.cc ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698