[asterisk-commits] tilghman: branch 1.4 r60850 - in /branches/1.4: ./ include/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 8 20:01:13 MST 2007


Author: tilghman
Date: Sun Apr  8 22:01:12 2007
New Revision: 60850

URL: http://svn.digium.com/view/asterisk?view=rev&rev=60850
Log:
Merged revisions 60849 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r60849 | tilghman | 2007-04-08 21:49:06 -0500 (Sun, 08 Apr 2007) | 2 lines

Don't check for error when lowering priority (according to the manpage, it should never happen anyway).  It might could happen, though, if another thread messed with the priority, so safeguard against that (reported via -dev list).

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/include/asterisk.h
    branches/1.4/main/asterisk.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk.h?view=diff&rev=60850&r1=60849&r2=60850
==============================================================================
--- branches/1.4/include/asterisk.h (original)
+++ branches/1.4/include/asterisk.h Sun Apr  8 22:01:12 2007
@@ -35,6 +35,8 @@
 
 #define DEFAULT_SAMPLE_RATE 8000
 #define DEFAULT_SAMPLES_PER_MS  ((DEFAULT_SAMPLE_RATE)/1000)
+#define	setpriority	__PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
+#define	sched_setscheduler	__PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
 
 /* provided in asterisk.c */
 extern char ast_config_AST_CONFIG_DIR[PATH_MAX];

Modified: branches/1.4/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/asterisk.c?view=diff&rev=60850&r1=60849&r2=60850
==============================================================================
--- branches/1.4/main/asterisk.c (original)
+++ branches/1.4/main/asterisk.c Sun Apr  8 22:01:12 2007
@@ -61,6 +61,8 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#undef sched_setscheduler
+#undef setpriority
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/time.h>
@@ -1175,10 +1177,8 @@
 				ast_verbose("Set to realtime thread\n");
 	} else {
 		sched.sched_priority = 0;
-		if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
-			ast_log(LOG_WARNING, "Unable to set normal priority\n");
-			return -1;
-		}
+		/* According to the manpage, these parameters can never fail. */
+		sched_setscheduler(0, SCHED_OTHER, &sched);
 	}
 #else
 	if (pri) {
@@ -1189,10 +1189,8 @@
 			if (option_verbose)
 				ast_verbose("Set to high priority\n");
 	} else {
-		if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
-			ast_log(LOG_WARNING, "Unable to set normal priority\n");
-			return -1;
-		}
+		/* According to the manpage, these parameters can never fail. */
+		setpriority(PRIO_PROCESS, 0, 0);
 	}
 #endif
 	return 0;



More information about the asterisk-commits mailing list