diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-04-09 03:04:07 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-04-09 03:04:07 +0000 |
commit | 5ecaea3d0a9b24bb40201829b60a5db254c0298a (patch) | |
tree | b9f232638a4a68965f66ed0a5e3afa63bd134464 | |
parent | c6c64af72d10a9f0aa624cfd00f9a5f7e3b703e2 (diff) |
Merged revisions 60850 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r60850 | tilghman | 2007-04-08 22:01:12 -0500 (Sun, 08 Apr 2007) | 10 lines
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).
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@60851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | include/asterisk.h | 2 | ||||
-rw-r--r-- | main/asterisk.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/asterisk.h b/include/asterisk.h index 52db3b91f..ffd081fdf 100644 --- a/include/asterisk.h +++ b/include/asterisk.h @@ -45,6 +45,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]; diff --git a/main/asterisk.c b/main/asterisk.c index 21c5290cb..6b0257492 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -61,6 +61,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +#undef sched_setscheduler +#undef setpriority #include <unistd.h> #include <stdlib.h> #include <sys/time.h> @@ -1133,10 +1135,8 @@ int ast_set_priority(int pri) 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) { @@ -1147,10 +1147,8 @@ int ast_set_priority(int pri) 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; |