| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 721 |
| 722 void Thread::YieldCPU() { | 722 void Thread::YieldCPU() { |
| 723 sched_yield(); | 723 sched_yield(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 | 726 |
| 727 class LinuxMutex : public Mutex { | 727 class LinuxMutex : public Mutex { |
| 728 public: | 728 public: |
| 729 LinuxMutex() { | 729 LinuxMutex() { |
| 730 pthread_mutexattr_t attrs; | 730 pthread_mutexattr_t attrs; |
| 731 int result = pthread_mutexattr_init(&attrs); | 731 #ifdef DEBUG |
| 732 ASSERT(result == 0); | 732 #define CHECK_RESULT(exp) ASSERT((exp) == 0) |
| 733 result = pthread_mutexattr_settype(&attrs, PTHREAD_MUTEX_RECURSIVE); | 733 #else |
| 734 ASSERT(result == 0); | 734 #define CHECK_RESULT(exp) exp |
| 735 result = pthread_mutex_init(&mutex_, &attrs); | 735 #endif |
| 736 ASSERT(result == 0); | 736 CHECK_RESULT(pthread_mutexattr_init(&attrs)); |
| 737 CHECK_RESULT(pthread_mutexattr_settype(&attrs, PTHREAD_MUTEX_RECURSIVE)); |
| 738 CHECK_RESULT(pthread_mutex_init(&mutex_, &attrs)); |
| 739 #undef CHECK_RESULT |
| 737 } | 740 } |
| 738 | 741 |
| 739 virtual ~LinuxMutex() { pthread_mutex_destroy(&mutex_); } | 742 virtual ~LinuxMutex() { pthread_mutex_destroy(&mutex_); } |
| 740 | 743 |
| 741 virtual int Lock() { | 744 virtual int Lock() { |
| 742 int result = pthread_mutex_lock(&mutex_); | 745 int result = pthread_mutex_lock(&mutex_); |
| 743 return result; | 746 return result; |
| 744 } | 747 } |
| 745 | 748 |
| 746 virtual int Unlock() { | 749 virtual int Unlock() { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 | 1123 |
| 1121 | 1124 |
| 1122 void Sampler::Stop() { | 1125 void Sampler::Stop() { |
| 1123 ASSERT(IsActive()); | 1126 ASSERT(IsActive()); |
| 1124 SignalSender::RemoveActiveSampler(this); | 1127 SignalSender::RemoveActiveSampler(this); |
| 1125 SetActive(false); | 1128 SetActive(false); |
| 1126 } | 1129 } |
| 1127 | 1130 |
| 1128 | 1131 |
| 1129 } } // namespace v8::internal | 1132 } } // namespace v8::internal |
| OLD | NEW |