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

Side by Side Diff: JavaScriptCore/wtf/ThreadingWin.cpp

Issue 28077: WebKit side of merge from r41149 to r41181. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/WebKit/
Patch Set: Created 11 years, 10 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 | « JavaScriptCore/wtf/ThreadingQt.cpp ('k') | WebCore/ChangeLog » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 450 }
451 451
452 bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime) 452 bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
453 { 453 {
454 double currentTime = WTF::currentTime(); 454 double currentTime = WTF::currentTime();
455 455
456 // Time is in the past - return immediately. 456 // Time is in the past - return immediately.
457 if (absoluteTime < currentTime) 457 if (absoluteTime < currentTime)
458 return false; 458 return false;
459 459
460 // Time is too far in the future (and would overflow unsigned long) - wait f orever.
461 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) {
462 wait(mutex);
463 return true;
464 }
465
460 double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0; 466 double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0;
461 if (intervalMilliseconds >= INT_MAX)
462 intervalMilliseconds = INT_MAX;
463
464 return m_condition.timedWait(mutex.impl(), static_cast<unsigned long>(interv alMilliseconds)); 467 return m_condition.timedWait(mutex.impl(), static_cast<unsigned long>(interv alMilliseconds));
465 } 468 }
466 469
467 void ThreadCondition::signal() 470 void ThreadCondition::signal()
468 { 471 {
469 m_condition.signal(false); // Unblock only 1 thread. 472 m_condition.signal(false); // Unblock only 1 thread.
470 } 473 }
471 474
472 void ThreadCondition::broadcast() 475 void ThreadCondition::broadcast()
473 { 476 {
474 m_condition.signal(true); // Unblock all threads. 477 m_condition.signal(true); // Unblock all threads.
475 } 478 }
476 479
477 } // namespace WTF 480 } // namespace WTF
OLDNEW
« no previous file with comments | « JavaScriptCore/wtf/ThreadingQt.cpp ('k') | WebCore/ChangeLog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698