If there are no timers then it makes no senes to process ticks in real
time. Sleep up to 0.5 seconds in that case. When timers are added we
are immediately woken up through the conditional variable. Only setting
the shutdown flag would not wake up the thread, but a sleep time of half
a second should be an acceptable delay for shutdowns.
Analogous to 695d902841
Change-Id: I37adf078825470af99e6a7755df3d8786d3eeaa6
Signal the sleeping thread through a condition variable whenever a new
event has been added to the queue. We can then process these events
immediately instead of having to wait for the timer to expire.
(The decision to use a separate private mutex and an extra bool value
for the AmCondition class of course is highly questionable, but that's
what we have in the code base for now.)
Change-Id: I78b74f1152e36aa106906e962bc133f15093ea02
Use one method for wheel turning and another separate method for events
processing. This logically separates two indepenent processes.
In the event of the actual sleep time being different from the requested
sleep time, we do the wheel turning based on the number of required
ticks, but run the events processing only once, after the wall clock has
been brought up to date.
Change-Id: Ibbc6571a5a569050647efd1ba595c1fd08918409
We may end up sleeping shorter or longer than the desired sleep time. If
we ended up sleeping shorter, don't advance a tick, and if we ended up
sleeping significantly longer (more than one tick), advance multiple
ticks.
Change-Id: I0be20104e6243c89006367430a3663cc304486b9
Go to sleep even if the sleep time is less than 2 ms. This makes the
math a lot easier and shouldn't have a noticeable impact as this is
a somewhat unnecessary attempt at optimization.
Analogous to 292eb8cf1c
Change-Id: I6d936a4450967dcd76b4647f189aa3f71e5ed7ae
By making the wall_clock private to the timer thread, we force all
externally used timers to use relative timeout values. Amend the timer
class to keep both timeout values for clarity.
The previously existing member `expires` is the absolute timeout, but is
now initially left unset (zero). Instead the given timeout value is put
into the new member `expires_rel` and the absolute timeout is calculated
only once the timer is inserted into the wheel by adding the current
wall clock.
We add an extra getter function for the current wall clock only for
debugging and logging purposes.
This also turns the two expiry timestamps kept in the timer class
protected and private, delegating maintenance to getter and setter
methods.
Change-Id: Ia6baf552a1de94ba64f314e9123df172b45eed85
Change it into a wrapper that directly calls time() to eliminate the
need of the timer thread to continuously set unix_clock to the current
time. With vDSO the call to time() is sufficiently cheap.
Move constructor to header and remove default empty destructor.
Change-Id: Ib812a993da9340b9ded4fd97c81d762d9452c3ea
SIP message processing and Session event processing are now
enclosed in blocks with the form
vv <type> [<callid>|<ltag>] ... vv
^^ <type> [<callid>|<ltag>] ... ^^
where
<type> = M SIP message processing
<type> = S Session event processing
- static library sip_stack.a (with dependencies on the core).
- removed AmServer and moved SipCtrlInterface into the core directory.
- TODO:
- CMake support to make core/sip/sip_stack.a and link against it in the core.
- merge AmSipRequest/AmSipReply and sip_msg structures.
git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1758 8eb893ce-cfd4-0310-b710-fb5ebe64c474