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

Unified Diff: src/v8threads.cc

Issue 171115: Linux profiler: check whether signal handler is called in the VM thread. (Closed)
Patch Set: Now dealing with multiple threads correctly, added test. Created 11 years, 3 months 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/v8threads.h ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8threads.cc
diff --git a/src/v8threads.cc b/src/v8threads.cc
index 8e0a8be5a504df0b2aeb412906d3110aa8e8b5cb..40e9f9f5f6f89d70640ec31f56a74963c2ea6b53 100644
--- a/src/v8threads.cc
+++ b/src/v8threads.cc
@@ -241,7 +241,7 @@ ThreadState* ThreadState::Next() {
}
-int ThreadManager::next_id_ = 0;
+int ThreadManager::last_id_ = 0;
Søren Thygesen Gjesse 2009/09/04 09:29:57 Please add a comment about that a thread cannot ha
Mikhail Naganov 2009/09/04 11:09:22 Done.
Mutex* ThreadManager::mutex_ = OS::CreateMutex();
ThreadHandle ThreadManager::mutex_owner_(ThreadHandle::INVALID);
ThreadHandle ThreadManager::lazily_archived_thread_(ThreadHandle::INVALID);
@@ -250,7 +250,7 @@ ThreadState* ThreadManager::lazily_archived_thread_state_ = NULL;
void ThreadManager::ArchiveThread() {
ASSERT(!lazily_archived_thread_.IsValid());
- ASSERT(Thread::GetThreadLocal(thread_state_key) == NULL);
+ ASSERT(!IsArchived());
ThreadState* state = ThreadState::GetFree();
state->Unlink();
Thread::SetThreadLocal(thread_state_key, reinterpret_cast<void*>(state));
@@ -281,6 +281,11 @@ void ThreadManager::EagerlyArchiveThread() {
}
+bool ThreadManager::IsArchived() {
+ return Thread::HasThreadLocal(thread_state_key);
+}
+
+
void ThreadManager::Iterate(ObjectVisitor* v) {
// Expecting no threads during serialization/deserialization
for (ThreadState* state = ThreadState::FirstInUse();
@@ -321,15 +326,20 @@ int ThreadManager::CurrentId() {
void ThreadManager::AssignId() {
- if (!Thread::HasThreadLocal(thread_id_key)) {
+ if (!HasId()) {
ASSERT(Locker::IsLocked());
- int thread_id = next_id_++;
+ int thread_id = ++last_id_;
Søren Thygesen Gjesse 2009/09/04 09:29:57 Maybe assert thread_id > 0.
Mikhail Naganov 2009/09/04 11:09:22 Done.
Thread::SetThreadLocalInt(thread_id_key, thread_id);
Top::set_thread_id(thread_id);
}
}
+bool ThreadManager::HasId() {
+ return Thread::HasThreadLocal(thread_id_key);
+}
+
+
void ThreadManager::TerminateExecution(int thread_id) {
for (ThreadState* state = ThreadState::FirstInUse();
state != NULL;
« no previous file with comments | « src/v8threads.h ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698