Version 3.0.6

Allowed getters and setters on JSArray elements (Issue 900).

Stopped JSON objects from hitting inherited setters (part of
Issue 1015).

Allowed numbers and strings as names of getters/setters in object
initializer (Issue 820).

Added use_system_v8 option to gyp (off by default), to make it easier
for Linux distributions to ship with system-provided V8 library.

Exported external array data accessors (Issue 1016).

Added labelled thread names to help with debugging (on Linux).

git-svn-id: http://v8.googlecode.com/svn/trunk@6169 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index 7efb25d..755e8cd 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -31,6 +31,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 #include <signal.h>
+#include <sys/prctl.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/syscall.h>
@@ -551,6 +552,12 @@
 
 
 Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
+  set_name("v8:<unknown>");
+}
+
+
+Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) {
+  set_name(name);
 }
 
 
@@ -563,6 +570,7 @@
   // This is also initialized by the first argument to pthread_create() but we
   // don't know which thread will run first (the original thread or the new
   // one) so we initialize it here too.
+  prctl(PR_SET_NAME, thread->name(), 0, 0, 0);
   thread->thread_handle_data()->thread_ = pthread_self();
   ASSERT(thread->IsValid());
   thread->Run();
@@ -570,6 +578,12 @@
 }
 
 
+void Thread::set_name(const char* name) {
+  strncpy(name_, name, sizeof(name_));
+  name_[sizeof(name_) - 1] = '\0';
+}
+
+
 void Thread::Start() {
   pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
   ASSERT(IsValid());