[Home]

Summary:ASTERISK-12162: [patch] changes use of usleep to nanosleep
Reporter:Patrick Putman (pputman)Labels:
Date Opened:2008-06-09 05:50:23Date Closed:2008-06-20 18:07:03
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_rpt
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_rtp_changes.patch
( 1) app_rtp_sleep.patch
Description:very simple patch which changes the use of usleep in an instance where it's argument was over 1 million to nanosleep to comply with the portability setting on the janitor projects.
Comments:By: David Woolley (davidw) 2008-06-09 07:21:05

It seems to me that "sleep" is most appropriate here.  The precision isn't needed and my understanding is that all modern systems implement sleep to the nearest tick, not the second.

Although Asterisk is generally unfriendly to power management, I gather the latest trend in Linux is to consolidating timer scheduling and using a tickless timer, to minimise the number of times the system is woken up.  I haven't looked at the kernel source for a tickless Linux, but conceivably nanosleep implies that the precision is intended whereas sleep doesn't, and, in this case, precision isn't intended.  (One might well want to disable the tickless logic for Asterisk, though.)

By: Patrick Putman (pputman) 2008-06-09 22:39:35

Easy change to make.  new patch uses sleep instead.

By: Digium Subversion (svnbot) 2008-06-20 18:05:25

Repository: asterisk
Revision: 124450

U   branches/1.4/apps/app_rpt.c

------------------------------------------------------------------------
r124450 | tilghman | 2008-06-20 18:05:24 -0500 (Fri, 20 Jun 2008) | 6 lines

usleep with a value over 1,000,000 is nonportable.  Changing to use sleep()
instead.  (closes issue ASTERISK-12162)
Reported by: pputman
Patches:
      app_rtp_sleep.patch uploaded by pputman (license 81)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124450

By: Digium Subversion (svnbot) 2008-06-20 18:06:27

Repository: asterisk
Revision: 124451

_U  trunk/
U   trunk/apps/app_rpt.c

------------------------------------------------------------------------
r124451 | tilghman | 2008-06-20 18:06:26 -0500 (Fri, 20 Jun 2008) | 14 lines

Merged revisions 124450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124450 | tilghman | 2008-06-20 18:12:33 -0500 (Fri, 20 Jun 2008) | 6 lines

usleep with a value over 1,000,000 is nonportable.  Changing to use sleep()
instead.  (closes issue ASTERISK-12162)
Reported by: pputman
Patches:
      app_rtp_sleep.patch uploaded by pputman (license 81)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124451

By: Digium Subversion (svnbot) 2008-06-20 18:07:03

Repository: asterisk
Revision: 124452

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_rpt.c

------------------------------------------------------------------------
r124452 | tilghman | 2008-06-20 18:07:03 -0500 (Fri, 20 Jun 2008) | 22 lines

Merged revisions 124451 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r124451 | tilghman | 2008-06-20 18:13:21 -0500 (Fri, 20 Jun 2008) | 14 lines

Merged revisions 124450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124450 | tilghman | 2008-06-20 18:12:33 -0500 (Fri, 20 Jun 2008) | 6 lines

usleep with a value over 1,000,000 is nonportable.  Changing to use sleep()
instead.  (closes issue ASTERISK-12162)
Reported by: pputman
Patches:
      app_rtp_sleep.patch uploaded by pputman (license 81)

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124452