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

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

Issue 42325: Circumvent a bug in older glibc (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (ts.tv_nsec >= kOneSecondNanos) { 627 if (ts.tv_nsec >= kOneSecondNanos) {
628 ts.tv_nsec -= kOneSecondNanos; 628 ts.tv_nsec -= kOneSecondNanos;
629 ts.tv_nsec++; 629 ts.tv_nsec++;
630 } 630 }
631 ts.tv_sec += secs; 631 ts.tv_sec += secs;
632 632
633 // Wait for semaphore signalled or timeout. 633 // Wait for semaphore signalled or timeout.
634 while (true) { 634 while (true) {
635 int result = sem_timedwait(&sem_, &ts); 635 int result = sem_timedwait(&sem_, &ts);
636 if (result == 0) return true; // Successfully got semaphore. 636 if (result == 0) return true; // Successfully got semaphore.
637 if (result > 0) {
638 // For glibc prior to 2.3.4 sem_timedwait returns the error instead of -1.
639 errno = result;
640 result = -1;
641 }
637 if (result == -1 && errno == ETIMEDOUT) return false; // Timeout. 642 if (result == -1 && errno == ETIMEDOUT) return false; // Timeout.
638 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. 643 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
639 } 644 }
640 } 645 }
641 646
642 647
643 Semaphore* OS::CreateSemaphore(int count) { 648 Semaphore* OS::CreateSemaphore(int count) {
644 return new LinuxSemaphore(count); 649 return new LinuxSemaphore(count);
645 } 650 }
646 651
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 894 }
890 895
891 // This sampler is no longer the active sampler. 896 // This sampler is no longer the active sampler.
892 active_sampler_ = NULL; 897 active_sampler_ = NULL;
893 active_ = false; 898 active_ = false;
894 } 899 }
895 900
896 #endif // ENABLE_LOGGING_AND_PROFILING 901 #endif // ENABLE_LOGGING_AND_PROFILING
897 902
898 } } // namespace v8::internal 903 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698