The intended signalling from StartTimer() to Process() is that
created_at_.tv_sec is set to 0, and timer_event_->Set() is then called
in order to wake the process thread from timer_event_->Wait(). When this
happens the process thread will return early and the run Process()
again. This time it will pick up created_at_.tv_sec = 0 and run a new
Wait() call with the desired end time.
However if the process thread was NOT blocking on timer_event_->Wait()
when timer_event_->Set() was called from StartTimer() it will mean that
the first call to timer_event_->Wait() from Process(), AFTER the new
time has been configured (count_ = 1), will return early.
If the timer is not periodic it means that Set() will never be called,
and any calls will Wait() will block until the time out.
The solution is to always reset the event in timer_event_ on the first
call to timerEvent_->Wait(), after a timer has started.
Also some general cleanup.
BUG=
Review URL: https://codereview.webrtc.org/1812533002
Cr-Commit-Position: refs/heads/master@{#12082}
Real time clock may cause problems as they can move (even backwards) if
the clock is changed, eg updated by NTP.
Non-monotonic clocks still in use on some platform (I'm looking at you,
Apple) for timed waits, but that should be less of an issue than actual
timestamps.
BUG=webrtc:5452
Review URL: https://codereview.webrtc.org/1613013002
Cr-Commit-Position: refs/heads/master@{#11375}
* Move PlatformThread to rtc::.
* Remove ::CreateThread factory method.
* Make non-scoped_ptr from a lot of invocations.
* Make Start/Stop void.
* Remove rtc::Thread priorities, which were unused and would collide.
* Add ::IsRunning() to PlatformThread.
BUG=
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1476453002 .
Cr-Commit-Position: refs/heads/master@{#10812}
Also removes all virtual methods. Permits using a thread from
rtc_base_approved (namely event tracing).
BUG=webrtc:5158
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1469013002
Cr-Commit-Position: refs/heads/master@{#10760}
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.
Alternative solutions:
* Check if we already have defined e.g. CHECK, and don't define them in that case. This makes us depend on include order in Chromium, which is not acceptable.
* Don't allow using the macros in WebRTC headers. Error prone since if someone adds it there by mistake it may compile fine, but later break if a header in added or order is changed in Chromium. That will be confusing and hard to enforce.
* Ensure that headers that are included by an embedder don't include our macros. This would require some heavy refactoring to be maintainable and enforcable.
* Changes in Chromium for this is obviously not an option.
BUG=chromium:468375
NOTRY=true
Review URL: https://codereview.webrtc.org/1335923002
Cr-Commit-Position: refs/heads/master@{#9964}
This reverts commit cf3c83e76c273309558c86fda915410f65b7a899.
Reverting EventWrapper split did not fix the issue, re-landing.
BUG=chromium:470013
TBR=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/49629004
Cr-Commit-Position: refs/heads/master@{#8946}
This reverts commit 9509fbfc301dd5412804ce5731afedc81480f2f8.
This is to debug a Chromium issue that WebRTC hangs if there is > 1 PeerConnection active in the browser on Win XP.
BUG=
TBR=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/43019004
Cr-Commit-Position: refs/heads/master@{#8912}
I'm splitting the timer functions in EventWrapper into a separate interface.
- Users of the timer functions have different needs than users of a generic event
- Providing a default implementation for EventWrapper that simply uses rtc::Event.
This means that clients of WebRTC that don't use the relatively few classes, typically rendering classes, that depend on the event timer functionality, also don't pull in dependencies on multimedia timers.
R=mflodman@webrtc.org, mflodman
BUG=
Review URL: https://webrtc-codereview.appspot.com/48599004
Cr-Commit-Position: refs/heads/master@{#8833}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8833 4adac7df-926f-26a2-2b94-8c16560cd09d