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

Side by Side Diff: src/platform-solaris.cc

Issue 7003108: "Deiceolate" Thread classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 373 }
374 374
375 375
376 class Thread::PlatformData : public Malloced { 376 class Thread::PlatformData : public Malloced {
377 public: 377 public:
378 PlatformData() : thread_(kNoThread) { } 378 PlatformData() : thread_(kNoThread) { }
379 379
380 pthread_t thread_; // Thread handle for pthread. 380 pthread_t thread_; // Thread handle for pthread.
381 }; 381 };
382 382
383 Thread::Thread(Isolate* isolate, const Options& options) 383 Thread::Thread(const Options& options)
384 : data_(new PlatformData()), 384 : data_(new PlatformData()),
385 isolate_(isolate), 385 isolate_(isolate),
Vitaly Repeshko 2011/06/10 08:18:50 Won't compile.
mnaganov (inactive) 2011/06/10 09:31:32 Done.
386 stack_size_(options.stack_size) { 386 stack_size_(options.stack_size) {
387 set_name(options.name); 387 set_name(options.name);
388 } 388 }
389 389
390 390
391 Thread::Thread(Isolate* isolate, const char* name) 391 Thread::Thread(Isolate* isolate, const char* name)
Vitaly Repeshko 2011/06/10 08:18:50 Ditto.
mnaganov (inactive) 2011/06/10 09:31:32 Done.
392 : data_(new PlatformData()), 392 : data_(new PlatformData()),
393 isolate_(isolate), 393 isolate_(isolate),
394 stack_size_(0) { 394 stack_size_(0) {
395 set_name(name); 395 set_name(name);
396 } 396 }
397 397
398 398
399 Thread::~Thread() { 399 Thread::~Thread() {
400 delete data_; 400 delete data_;
401 } 401 }
402 402
403 403
404 static void* ThreadEntry(void* arg) { 404 static void* ThreadEntry(void* arg) {
405 Thread* thread = reinterpret_cast<Thread*>(arg); 405 Thread* thread = reinterpret_cast<Thread*>(arg);
406 // This is also initialized by the first argument to pthread_create() but we 406 // This is also initialized by the first argument to pthread_create() but we
407 // don't know which thread will run first (the original thread or the new 407 // don't know which thread will run first (the original thread or the new
408 // one) so we initialize it here too. 408 // one) so we initialize it here too.
409 thread->data()->thread_ = pthread_self(); 409 thread->data()->thread_ = pthread_self();
410 ASSERT(thread->data()->thread_ != kNoThread); 410 ASSERT(thread->data()->thread_ != kNoThread);
411 Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
412 thread->Run(); 411 thread->Run();
413 return NULL; 412 return NULL;
414 } 413 }
415 414
416 415
417 void Thread::set_name(const char* name) { 416 void Thread::set_name(const char* name) {
418 strncpy(name_, name, sizeof(name_)); 417 strncpy(name_, name, sizeof(name_));
419 name_[sizeof(name_) - 1] = '\0'; 418 name_[sizeof(name_) - 1] = '\0';
420 } 419 }
421 420
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 data_->signal_handler_installed_ = false; 752 data_->signal_handler_installed_ = false;
754 } 753 }
755 754
756 // This sampler is no longer the active sampler. 755 // This sampler is no longer the active sampler.
757 active_sampler_ = NULL; 756 active_sampler_ = NULL;
758 } 757 }
759 758
760 #endif // ENABLE_LOGGING_AND_PROFILING 759 #endif // ENABLE_LOGGING_AND_PROFILING
761 760
762 } } // namespace v8::internal 761 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698