Revision: 7289
Author: [email protected]
Date: Mon Mar 21 08:04:17 2011
Log: Use v8::internal threading support in samples/shell.cc.
We need this for isolates testing. To make it work I had to extend the
internal Thread constructor with an option to set the stack size (see
the comment in shell.cc).
BUG=1264
Review URL: http://codereview.chromium.org/6711068
http://code.google.com/p/v8/source/detail?r=7289
Modified:
/branches/bleeding_edge/samples/shell.cc
/branches/bleeding_edge/src/platform-cygwin.cc
/branches/bleeding_edge/src/platform-freebsd.cc
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform-macos.cc
/branches/bleeding_edge/src/platform-nullos.cc
/branches/bleeding_edge/src/platform-openbsd.cc
/branches/bleeding_edge/src/platform-solaris.cc
/branches/bleeding_edge/src/platform-win32.cc
/branches/bleeding_edge/src/platform.h
/branches/bleeding_edge/test/cctest/cctest.h
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-circular-queue.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
/branches/bleeding_edge/test/cctest/test-sockets.cc
/branches/bleeding_edge/test/cctest/test-thread-termination.cc
/branches/bleeding_edge/test/cctest/test-threads.cc
=======================================
--- /branches/bleeding_edge/samples/shell.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/samples/shell.cc Mon Mar 21 08:04:17 2011
@@ -35,12 +35,7 @@
#include "../src/v8.h"
-// TODO(isolates):
-// o Either use V8 internal platform stuff for every platform or
-// re-implement it.
-// o Do not assume not WIN32 implies pthreads.
-#ifndef WIN32
-#include <pthread.h> // NOLINT
+#if !defined(_WIN32) && !defined(_WIN64)
#include <unistd.h> // NOLINT
#endif
@@ -67,10 +62,6 @@
void ReportException(v8::TryCatch* handler);
-#ifndef WIN32
-void* IsolateThreadEntry(void* arg);
-#endif
-
static bool last_run = true;
class SourceGroup {
@@ -78,14 +69,9 @@
SourceGroup() : argv_(NULL),
begin_offset_(0),
end_offset_(0),
- next_semaphore_(NULL),
- done_semaphore_(NULL) {
-#ifndef WIN32
- next_semaphore_ = v8::internal::OS::CreateSemaphore(0);
- done_semaphore_ = v8::internal::OS::CreateSemaphore(0);
- thread_ = 0;
-#endif
- }
+ next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
+ done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
+ thread_(NULL) { }
void Begin(char** argv, int offset) {
argv_ = const_cast<const char**>(argv);
@@ -125,42 +111,49 @@
}
}
-#ifdef WIN32
- void StartExecuteInThread() { ExecuteInThread(); }
- void WaitForThread() {}
-
-#else
void StartExecuteInThread() {
- if (thread_ == 0) {
- pthread_attr_t attr;
- // On some systems (OSX 10.6) the stack size default is 0.5Mb or less
- // which is not enough to parse the big literal expressions used in
tests.
- // The stack size should be at least StackGuard::kLimitSize + some
- // OS-specific padding for thread startup code.
- size_t stacksize = 2 << 20; // 2 Mb seems to be enough
- pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, stacksize);
- int error = pthread_create(&thread_, &attr, &IsolateThreadEntry,
this);
- if (error != 0) {
- fprintf(stderr, "Error creating isolate thread.\n");
- ExitShell(1);
- }
+ if (thread_ == NULL) {
+ thread_ = new IsolateThread(this);
+ thread_->Start();
}
next_semaphore_->Signal();
}
void WaitForThread() {
- if (thread_ == 0) return;
+ if (thread_ == NULL) return;
if (last_run) {
- pthread_join(thread_, NULL);
- thread_ = 0;
+ thread_->Join();
+ thread_ = NULL;
} else {
done_semaphore_->Wait();
}
}
-#endif // WIN32
private:
+ static v8::internal::Thread::Options GetThreadOptions() {
+ v8::internal::Thread::Options options;
+ options.name = "IsolateThread";
+ // On some systems (OSX 10.6) the stack size default is 0.5Mb or less
+ // which is not enough to parse the big literal expressions used in
tests.
+ // The stack size should be at least StackGuard::kLimitSize + some
+ // OS-specific padding for thread startup code.
+ options.stack_size = 2 << 20; // 2 Mb seems to be enough
+ return options;
+ }
+
+ class IsolateThread : public v8::internal::Thread {
+ public:
+ explicit IsolateThread(SourceGroup* group)
+ : group_(group), v8::internal::Thread(NULL, GetThreadOptions()) {}
+
+ virtual void Run() {
+ group_->ExecuteInThread();
+ }
+
+ private:
+ SourceGroup* group_;
+ };
+
void ExecuteInThread() {
v8::Isolate* isolate = v8::Isolate::New();
do {
@@ -185,20 +178,9 @@
int end_offset_;
v8::internal::Semaphore* next_semaphore_;
v8::internal::Semaphore* done_semaphore_;
-#ifndef WIN32
- pthread_t thread_;
-#endif
-
- friend void* IsolateThreadEntry(void* arg);
+ v8::internal::Thread* thread_;
};
-#ifndef WIN32
-void* IsolateThreadEntry(void* arg) {
- reinterpret_cast<SourceGroup*>(arg)->ExecuteInThread();
- return NULL;
-}
-#endif
-
static SourceGroup* isolate_sources = NULL;
=======================================
--- /branches/bleeding_edge/src/platform-cygwin.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-cygwin.cc Mon Mar 21 08:04:17 2011
@@ -400,12 +400,18 @@
}
-Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
- set_name("v8:<unknown>");
+Thread::Thread(Isolate* isolate, const Options& options)
+ : ThreadHandle(ThreadHandle::INVALID),
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
}
-Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) {
+Thread::Thread(Isolate* isolate, const char* name)
+ : ThreadHandle(ThreadHandle::INVALID),
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-freebsd.cc Mon Mar 21 08:04:17 2011
@@ -425,15 +425,18 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
-}
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
+}
+
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
@@ -462,7 +465,14 @@
void Thread::Start() {
- pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
+ pthread_attr_t* attr_ptr = NULL;
+ pthread_attr_t attr;
+ if (stack_size_ > 0) {
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
+ attr_ptr = &attr;
+ }
+ pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry,
this);
ASSERT(IsValid());
}
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-linux.cc Mon Mar 21 08:04:17 2011
@@ -573,16 +573,18 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
@@ -614,7 +616,14 @@
void Thread::Start() {
- pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
+ pthread_attr_t* attr_ptr = NULL;
+ pthread_attr_t attr;
+ if (stack_size_ > 0) {
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
+ attr_ptr = &attr;
+ }
+ pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry,
this);
ASSERT(IsValid());
}
@@ -875,7 +884,9 @@
};
explicit SignalSender(int interval)
- : Thread(NULL), vm_tgid_(getpid()), interval_(interval) {}
+ : Thread(NULL, "SignalSender"),
+ vm_tgid_(getpid()),
+ interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-macos.cc Mon Mar 21 08:04:17 2011
@@ -432,23 +432,24 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
Thread::~Thread() {
}
-
static void SetThreadName(const char* name) {
@@ -489,7 +490,15 @@
void Thread::Start() {
- pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
+ pthread_attr_t* attr_ptr = NULL;
+ pthread_attr_t attr;
+ if (stack_size_ > 0) {
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
+ attr_ptr = &attr;
+ }
+ pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry,
this);
+ ASSERT(IsValid());
}
@@ -626,7 +635,9 @@
class SamplerThread : public Thread {
public:
- explicit SamplerThread(int interval) : Thread(NULL), interval_(interval)
{}
+ explicit SamplerThread(int interval)
+ : Thread(NULL, "SamplerThread"),
+ interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
=======================================
--- /branches/bleeding_edge/src/platform-nullos.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-nullos.cc Mon Mar 21 08:04:17 2011
@@ -340,17 +340,19 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
UNIMPLEMENTED();
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
UNIMPLEMENTED();
}
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-openbsd.cc Mon Mar 21 08:04:17 2011
@@ -400,16 +400,18 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
@@ -438,7 +440,14 @@
void Thread::Start() {
- pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
+ pthread_attr_t* attr_ptr = NULL;
+ pthread_attr_t attr;
+ if (stack_size_ > 0) {
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
+ attr_ptr = &attr;
+ }
+ pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry,
this);
ASSERT(IsValid());
}
=======================================
--- /branches/bleeding_edge/src/platform-solaris.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-solaris.cc Mon Mar 21 08:04:17 2011
@@ -415,16 +415,18 @@
}
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
- set_name("v8:<unknown>");
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
+ set_name(options.name);
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
set_name(name);
}
@@ -453,6 +455,13 @@
void Thread::Start() {
+ pthread_attr_t* attr_ptr = NULL;
+ pthread_attr_t attr;
+ if (stack_size_ > 0) {
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
+ attr_ptr = &attr;
+ }
pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
ASSERT(IsValid());
}
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform-win32.cc Mon Mar 21 08:04:17 2011
@@ -1503,17 +1503,19 @@
// Initialize a Win32 thread object. The thread has an invalid thread
// handle until it is started.
-Thread::Thread(Isolate* isolate)
+Thread::Thread(Isolate* isolate, const Options& options)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(options.stack_size) {
data_ = new PlatformData(kNoThread);
- set_name("v8:<unknown>");
+ set_name(options.name);
}
Thread::Thread(Isolate* isolate, const char* name)
: ThreadHandle(ThreadHandle::INVALID),
- isolate_(isolate) {
+ isolate_(isolate),
+ stack_size_(0) {
data_ = new PlatformData(kNoThread);
set_name(name);
}
@@ -1538,7 +1540,7 @@
void Thread::Start() {
data_->thread_ = reinterpret_cast<HANDLE>(
_beginthreadex(NULL,
- 0,
+ static_cast<unsigned>(stack_size_),
ThreadEntry,
this,
0,
@@ -1884,7 +1886,9 @@
class SamplerThread : public Thread {
public:
- explicit SamplerThread(int interval) : Thread(NULL), interval_(interval)
{}
+ explicit SamplerThread(int interval)
+ : Thread(NULL, "SamplerThread"),
+ interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
=======================================
--- /branches/bleeding_edge/src/platform.h Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/platform.h Mon Mar 21 08:04:17 2011
@@ -388,8 +388,15 @@
LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
};
+ struct Options {
+ Options() : name("v8:<unknown>"), stack_size(0) {}
+
+ const char* name;
+ int stack_size;
+ };
+
// Create new thread (with a value for storing in the TLS isolate field).
- explicit Thread(Isolate* isolate);
+ Thread(Isolate* isolate, const Options& options);
Thread(Isolate* isolate, const char* name);
virtual ~Thread();
@@ -436,6 +443,7 @@
PlatformData* data_;
Isolate* isolate_;
char name_[kMaxThreadNameLength];
+ int stack_size_;
DISALLOW_COPY_AND_ASSIGN(Thread);
};
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.h Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/cctest.h Mon Mar 21 08:04:17 2011
@@ -88,7 +88,7 @@
public:
void CallTest();
explicit ApiTestFuzzer(v8::internal::Isolate* isolate, int num)
- : Thread(isolate),
+ : Thread(isolate, "ApiTestFuzzer"),
test_number_(num),
gate_(v8::internal::OS::CreateSemaphore(0)),
active_(true) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Mar 21 08:04:17 2011
@@ -9929,7 +9929,7 @@
class GCThread : public i::Thread {
public:
explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test)
- : Thread(isolate), test_(test) {}
+ : Thread(isolate, "GCThread"), test_(test) {}
virtual void Run() {
test_->CollectGarbage();
}
@@ -10051,7 +10051,7 @@
class GCThread : public i::Thread {
public:
explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test)
- : Thread(isolate), test_(test) {}
+ : Thread(isolate, "GCThread"), test_(test) {}
virtual void Run() {
test_->CollectGarbage();
}
@@ -10347,7 +10347,7 @@
public:
explicit MorphThread(i::Isolate* isolate,
RegExpStringModificationTest* test)
- : Thread(isolate), test_(test) {}
+ : Thread(isolate, "MorphThread"), test_(test) {}
virtual void Run() {
test_->MorphString();
}
@@ -13044,10 +13044,10 @@
class IsolateThread : public v8::internal::Thread {
public:
explicit IsolateThread(v8::Isolate* isolate, int fib_limit)
- : Thread(NULL),
- isolate_(isolate),
- fib_limit_(fib_limit),
- result_(0) { }
+ : Thread(NULL, "IsolateThread"),
+ isolate_(isolate),
+ fib_limit_(fib_limit),
+ result_(0) { }
void Run() {
result_ = CalcFibonacci(isolate_, fib_limit_);
@@ -13095,9 +13095,9 @@
enum TestCase { IgnoreOOM, SetResourceConstraints, SetFatalHandler };
explicit InitDefaultIsolateThread(TestCase testCase)
- : Thread(NULL),
- testCase_(testCase),
- result_(false) { }
+ : Thread(NULL, "InitDefaultIsolateThread"),
+ testCase_(testCase),
+ result_(false) { }
void Run() {
switch (testCase_) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-circular-queue.cc Fri Mar 18
13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/test-circular-queue.cc Mon Mar 21
08:04:17 2011
@@ -89,7 +89,7 @@
int records_per_chunk,
Record value,
i::Semaphore* finished)
- : Thread(isolate),
+ : Thread(isolate, "producer"),
scq_(scq),
records_per_chunk_(records_per_chunk),
value_(value),
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Fri Mar 18 13:35:07
2011
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Mon Mar 21 08:04:17
2011
@@ -4721,7 +4721,7 @@
class MessageQueueDebuggerThread : public v8::internal::Thread {
public:
explicit MessageQueueDebuggerThread(v8::internal::Isolate* isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "MessageQueueDebuggerThread") { }
void Run();
};
@@ -4972,13 +4972,15 @@
class V8Thread : public v8::internal::Thread {
public:
- explicit V8Thread(v8::internal::Isolate* isolate) : Thread(isolate) { }
+ explicit V8Thread(v8::internal::Isolate* isolate)
+ : Thread(isolate, "V8Thread") { }
void Run();
};
class DebuggerThread : public v8::internal::Thread {
public:
- explicit DebuggerThread(v8::internal::Isolate* isolate) :
Thread(isolate) { }
+ explicit DebuggerThread(v8::internal::Isolate* isolate)
+ : Thread(isolate, "DebuggerThread") { }
void Run();
};
@@ -5078,7 +5080,7 @@
class BreakpointsV8Thread : public v8::internal::Thread {
public:
explicit BreakpointsV8Thread(v8::internal::Isolate* isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "BreakpointsV8Thread") { }
void Run();
};
@@ -5086,7 +5088,8 @@
public:
explicit BreakpointsDebuggerThread(v8::internal::Isolate* isolate,
bool global_evaluate)
- : Thread(isolate), global_evaluate_(global_evaluate) {}
+ : Thread(isolate, "BreakpointsDebuggerThread"),
+ global_evaluate_(global_evaluate) {}
void Run();
private:
@@ -5647,14 +5650,14 @@
class HostDispatchV8Thread : public v8::internal::Thread {
public:
explicit HostDispatchV8Thread(v8::internal::Isolate* isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "HostDispatchV8Thread") { }
void Run();
};
class HostDispatchDebuggerThread : public v8::internal::Thread {
public:
explicit HostDispatchDebuggerThread(v8::internal::Isolate* isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "HostDispatchDebuggerThread") { }
void Run();
};
@@ -5753,14 +5756,14 @@
class DebugMessageDispatchV8Thread : public v8::internal::Thread {
public:
explicit DebugMessageDispatchV8Thread(v8::internal::Isolate* isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "DebugMessageDispatchV8Thread") { }
void Run();
};
class DebugMessageDispatchDebuggerThread : public v8::internal::Thread {
public:
explicit DebugMessageDispatchDebuggerThread(v8::internal::Isolate*
isolate)
- : Thread(isolate) { }
+ : Thread(isolate, "DebugMessageDispatchDebuggerThread") { }
void Run();
};
@@ -5863,7 +5866,10 @@
class DebuggerAgentProtocolServerThread : public i::Thread {
public:
explicit DebuggerAgentProtocolServerThread(i::Isolate* isolate, int port)
- : Thread(isolate), port_(port), server_(NULL), client_(NULL),
+ : Thread(isolate, "DebuggerAgentProtocolServerThread"),
+ port_(port),
+ server_(NULL),
+ client_(NULL),
listening_(OS::CreateSemaphore(0)) {
}
~DebuggerAgentProtocolServerThread() {
=======================================
--- /branches/bleeding_edge/test/cctest/test-sockets.cc Fri Mar 18 13:35:07
2011
+++ /branches/bleeding_edge/test/cctest/test-sockets.cc Mon Mar 21 08:04:17
2011
@@ -11,8 +11,12 @@
class SocketListenerThread : public Thread {
public:
explicit SocketListenerThread(Isolate* isolate, int port, int data_size)
- : Thread(isolate), port_(port), data_size_(data_size), server_(NULL),
- client_(NULL), listening_(OS::CreateSemaphore(0)) {
+ : Thread(isolate, "SocketListenerThread"),
+ port_(port),
+ data_size_(data_size),
+ server_(NULL),
+ client_(NULL),
+ listening_(OS::CreateSemaphore(0)) {
data_ = new char[data_size_];
}
~SocketListenerThread() {
=======================================
--- /branches/bleeding_edge/test/cctest/test-thread-termination.cc Fri Mar
18 13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/test-thread-termination.cc Mon Mar
21 08:04:17 2011
@@ -160,7 +160,8 @@
class TerminatorThread : public v8::internal::Thread {
public:
- explicit TerminatorThread(i::Isolate* isolate) : Thread(isolate) { }
+ explicit TerminatorThread(i::Isolate* isolate)
+ : Thread(isolate, "TerminatorThread") { }
void Run() {
semaphore->Wait();
CHECK(!v8::V8::IsExecutionTerminating());
@@ -195,7 +196,8 @@
class LoopingThread : public v8::internal::Thread {
public:
- explicit LoopingThread(i::Isolate* isolate) : Thread(isolate) { }
+ explicit LoopingThread(i::Isolate* isolate)
+ : Thread(isolate, "LoopingThread") { }
void Run() {
v8::Locker locker;
v8::HandleScope scope;
=======================================
--- /branches/bleeding_edge/test/cctest/test-threads.cc Fri Mar 18 13:35:07
2011
+++ /branches/bleeding_edge/test/cctest/test-threads.cc Mon Mar 21 08:04:17
2011
@@ -64,7 +64,7 @@
class ThreadA: public v8::internal::Thread {
public:
- explicit ThreadA(i::Isolate* isolate) : Thread(isolate) { }
+ explicit ThreadA(i::Isolate* isolate) : Thread(isolate, "ThreadA") { }
void Run() {
v8::Locker locker;
v8::HandleScope scope;
@@ -100,7 +100,7 @@
class ThreadB: public v8::internal::Thread {
public:
- explicit ThreadB(i::Isolate* isolate) : Thread(isolate) { }
+ explicit ThreadB(i::Isolate* isolate) : Thread(isolate, "ThreadB") { }
void Run() {
do {
{
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev