| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 public: | 381 public: |
| 382 // Opaque data type for thread-local storage keys. | 382 // Opaque data type for thread-local storage keys. |
| 383 // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified | 383 // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified |
| 384 // to ensure that enumeration type has correct value range (see Issue 830 for | 384 // to ensure that enumeration type has correct value range (see Issue 830 for |
| 385 // more details). | 385 // more details). |
| 386 enum LocalStorageKey { | 386 enum LocalStorageKey { |
| 387 LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt, | 387 LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt, |
| 388 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt | 388 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt |
| 389 }; | 389 }; |
| 390 | 390 |
| 391 struct Options { |
| 392 Options() : name("v8:<unknown>"), stack_size(0) {} |
| 393 |
| 394 const char* name; |
| 395 int stack_size; |
| 396 }; |
| 397 |
| 391 // Create new thread (with a value for storing in the TLS isolate field). | 398 // Create new thread (with a value for storing in the TLS isolate field). |
| 392 explicit Thread(Isolate* isolate); | 399 Thread(Isolate* isolate, const Options& options); |
| 393 Thread(Isolate* isolate, const char* name); | 400 Thread(Isolate* isolate, const char* name); |
| 394 virtual ~Thread(); | 401 virtual ~Thread(); |
| 395 | 402 |
| 396 // Start new thread by calling the Run() method in the new thread. | 403 // Start new thread by calling the Run() method in the new thread. |
| 397 void Start(); | 404 void Start(); |
| 398 | 405 |
| 399 // Wait until thread terminates. | 406 // Wait until thread terminates. |
| 400 void Join(); | 407 void Join(); |
| 401 | 408 |
| 402 inline const char* name() const { | 409 inline const char* name() const { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 429 // The thread name length is limited to 16 based on Linux's implementation of | 436 // The thread name length is limited to 16 based on Linux's implementation of |
| 430 // prctl(). | 437 // prctl(). |
| 431 static const int kMaxThreadNameLength = 16; | 438 static const int kMaxThreadNameLength = 16; |
| 432 private: | 439 private: |
| 433 void set_name(const char *name); | 440 void set_name(const char *name); |
| 434 | 441 |
| 435 class PlatformData; | 442 class PlatformData; |
| 436 PlatformData* data_; | 443 PlatformData* data_; |
| 437 Isolate* isolate_; | 444 Isolate* isolate_; |
| 438 char name_[kMaxThreadNameLength]; | 445 char name_[kMaxThreadNameLength]; |
| 446 int stack_size_; |
| 439 | 447 |
| 440 DISALLOW_COPY_AND_ASSIGN(Thread); | 448 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 441 }; | 449 }; |
| 442 | 450 |
| 443 | 451 |
| 444 // ---------------------------------------------------------------------------- | 452 // ---------------------------------------------------------------------------- |
| 445 // Mutex | 453 // Mutex |
| 446 // | 454 // |
| 447 // Mutexes are used for serializing access to non-reentrant sections of code. | 455 // Mutexes are used for serializing access to non-reentrant sections of code. |
| 448 // The implementations of mutex should allow for nested/recursive locking. | 456 // The implementations of mutex should allow for nested/recursive locking. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 int samples_taken_; // Counts stack samples taken. | 647 int samples_taken_; // Counts stack samples taken. |
| 640 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 648 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 641 }; | 649 }; |
| 642 | 650 |
| 643 | 651 |
| 644 #endif // ENABLE_LOGGING_AND_PROFILING | 652 #endif // ENABLE_LOGGING_AND_PROFILING |
| 645 | 653 |
| 646 } } // namespace v8::internal | 654 } } // namespace v8::internal |
| 647 | 655 |
| 648 #endif // V8_PLATFORM_H_ | 656 #endif // V8_PLATFORM_H_ |
| OLD | NEW |