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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 if (result == 0) return; // Successfully got semaphore. | 504 if (result == 0) return; // Successfully got semaphore. |
505 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. | 505 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 | 509 |
510 #ifndef TIMEVAL_TO_TIMESPEC | 510 #ifndef TIMEVAL_TO_TIMESPEC |
511 #define TIMEVAL_TO_TIMESPEC(tv, ts) do { \ | 511 #define TIMEVAL_TO_TIMESPEC(tv, ts) do { \ |
512 (ts)->tv_sec = (tv)->tv_sec; \ | 512 (ts)->tv_sec = (tv)->tv_sec; \ |
513 (ts)->tv_nsec = (tv)->tv_usec * 1000; \ | 513 (ts)->tv_nsec = (tv)->tv_usec * 1000; \ |
514 } while(false) | 514 } while (false) |
515 #endif | 515 #endif |
516 | 516 |
517 | 517 |
518 bool LinuxSemaphore::Wait(int timeout) { | 518 bool LinuxSemaphore::Wait(int timeout) { |
519 const long kOneSecondMicros = 1000000; // NOLINT | 519 const long kOneSecondMicros = 1000000; // NOLINT |
520 | 520 |
521 // Split timeout into second and nanosecond parts. | 521 // Split timeout into second and nanosecond parts. |
522 struct timeval delta; | 522 struct timeval delta; |
523 delta.tv_usec = timeout % kOneSecondMicros; | 523 delta.tv_usec = timeout % kOneSecondMicros; |
524 delta.tv_sec = timeout / kOneSecondMicros; | 524 delta.tv_sec = timeout / kOneSecondMicros; |
525 | 525 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 } | 675 } |
676 | 676 |
677 // This sampler is no longer the active sampler. | 677 // This sampler is no longer the active sampler. |
678 active_sampler_ = NULL; | 678 active_sampler_ = NULL; |
679 active_ = false; | 679 active_ = false; |
680 } | 680 } |
681 | 681 |
682 #endif // ENABLE_LOGGING_AND_PROFILING | 682 #endif // ENABLE_LOGGING_AND_PROFILING |
683 | 683 |
684 } } // namespace v8::internal | 684 } } // namespace v8::internal |
OLD | NEW |