Fix build on FreeBSD.
Patch by Akinori MUSHA. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7811 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
912ec759da
commit
f5af29e848
@ -52,6 +52,7 @@
|
|||||||
#undef MAP_TYPE
|
#undef MAP_TYPE
|
||||||
|
|
||||||
#include "v8.h"
|
#include "v8.h"
|
||||||
|
#include "v8threads.h"
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "vm-state-inl.h"
|
#include "vm-state-inl.h"
|
||||||
@ -397,31 +398,6 @@ class Thread::PlatformData : public Malloced {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ThreadHandle::ThreadHandle(Kind kind) {
|
|
||||||
data_ = new PlatformData(kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThreadHandle::Initialize(ThreadHandle::Kind kind) {
|
|
||||||
data_->Initialize(kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ThreadHandle::~ThreadHandle() {
|
|
||||||
delete data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ThreadHandle::IsSelf() const {
|
|
||||||
return pthread_equal(data_->thread_, pthread_self());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ThreadHandle::IsValid() const {
|
|
||||||
return data_->thread_ != kNoThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Thread::Thread(Isolate* isolate, const Options& options)
|
Thread::Thread(Isolate* isolate, const Options& options)
|
||||||
: data_(new PlatformData),
|
: data_(new PlatformData),
|
||||||
isolate_(isolate),
|
isolate_(isolate),
|
||||||
@ -448,8 +424,8 @@ static void* ThreadEntry(void* arg) {
|
|||||||
// This is also initialized by the first argument to pthread_create() but we
|
// 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
|
// don't know which thread will run first (the original thread or the new
|
||||||
// one) so we initialize it here too.
|
// one) so we initialize it here too.
|
||||||
thread_->data_->thread_ = pthread_self();
|
thread->data()->thread_ = pthread_self();
|
||||||
ASSERT(thread->IsValid());
|
ASSERT(thread->data()->thread_ != kNoThread);
|
||||||
Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
|
Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
|
||||||
thread->Run();
|
thread->Run();
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -470,13 +446,13 @@ void Thread::Start() {
|
|||||||
pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
|
pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
|
||||||
attr_ptr = &attr;
|
attr_ptr = &attr;
|
||||||
}
|
}
|
||||||
pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this);
|
pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this);
|
||||||
ASSERT(IsValid());
|
ASSERT(data_->thread_ != kNoThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Thread::Join() {
|
void Thread::Join() {
|
||||||
pthread_join(thread_handle_data()->thread_, NULL);
|
pthread_join(data_->thread_, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user