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

Unified Diff: src/v8threads.h

Issue 6816038: Do not rely on uniquiness of pthread_t Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ThreadRef -> ThreadId Created 9 years, 8 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
Index: src/v8threads.h
diff --git a/src/v8threads.h b/src/v8threads.h
index 1266af7c698b2a999fd982cf905886800f0d77f6..2b7ba653ee60fc1ae3ded8a68179cc4b2ac55618 100644
--- a/src/v8threads.h
+++ b/src/v8threads.h
@@ -43,8 +43,8 @@ class ThreadState {
void Unlink();
// Id of thread.
- void set_id(int id) { id_ = id; }
- int id() { return id_; }
+ void set_id(ThreadId id) { id_ = id; }
+ ThreadId id() { return id_; }
// Should the thread be terminated when it is restored?
bool terminate_on_restore() { return terminate_on_restore_; }
@@ -59,7 +59,7 @@ class ThreadState {
void AllocateSpace();
- int id_;
+ ThreadId id_;
bool terminate_on_restore_;
char* data_;
ThreadState* next_;
@@ -85,6 +85,7 @@ class ThreadVisitor {
};
Vitaly Repeshko 2011/04/11 19:28:52 Only two-blank lines are needed here.
+
class ThreadManager {
public:
void Lock();
@@ -97,17 +98,18 @@ class ThreadManager {
void Iterate(ObjectVisitor* v);
void IterateArchivedThreads(ThreadVisitor* v);
- bool IsLockedByCurrentThread() { return mutex_owner_.IsSelf(); }
+ bool IsLockedByCurrentThread() {
+ return mutex_owner_.Equals(ThreadId::Current());
+ }
- int CurrentId();
+ ThreadId CurrentId();
- void TerminateExecution(int thread_id);
+ void TerminateExecution(ThreadId thread_id);
// Iterate over in-use states.
ThreadState* FirstThreadStateInUse();
ThreadState* GetFreeThreadState();
- static const int kInvalidId = -1;
private:
ThreadManager();
~ThreadManager();
@@ -115,8 +117,8 @@ class ThreadManager {
void EagerlyArchiveThread();
Mutex* mutex_;
- ThreadHandle mutex_owner_;
- ThreadHandle lazily_archived_thread_;
+ ThreadId mutex_owner_;
+ ThreadId lazily_archived_thread_;
ThreadState* lazily_archived_thread_state_;
// In the following two lists there is always at least one object on the list.

Powered by Google App Engine
This is Rietveld 408576698