annotate osdep/priority.c @ 35758:75724b59a3a8

Make uiMainRender static. We don't need to set uiMainRender False, because since r35846 there is no longer a handler function that must be blocked.
author ib
date Thu, 24 Jan 2013 16:34:35 +0000
parents fbfde63a7e82
children 389d43c448b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28485
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
1 /*
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
2 * implementation of '-priority' for OS/2 and Win32
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
3 *
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
4 * Copyright (c) 2009 by KO Myung-Hun (komh@chollian.net)
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
5 *
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
6 * This file is part of MPlayer.
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
7 *
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
11 * (at your option) any later version.
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
12 *
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
16 * GNU General Public License for more details.
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
17 *
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License along
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
21 */
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
22
30786
24c1cedb1de2 1. Move the macros for priority classes for OS/2 from priority.c to osdep.h
komh
parents: 30633
diff changeset
23 #include "osdep.h"
28485
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
24
34121
fbfde63a7e82 Fix include condition.
ib
parents: 34115
diff changeset
25 #ifndef __OS2__
28485
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
26 #include <windows.h>
30786
24c1cedb1de2 1. Move the macros for priority classes for OS/2 from priority.c to osdep.h
komh
parents: 30633
diff changeset
27 #endif
28485
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
28
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
29 #include <string.h>
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
30
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
31 #include "mp_msg.h"
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
32 #include "help_mp.h"
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
33
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
34 #include "priority.h"
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
35
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
36 char *proc_priority = NULL;
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
37
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
38 void set_priority(void)
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
39 {
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
40 struct {
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
41 char* name;
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
42 int prio;
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
43 } priority_presets_defs[] = {
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
44 { "realtime", REALTIME_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
45 { "high", HIGH_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
46 #ifdef ABOVE_NORMAL_PRIORITY_CLASS
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
47 { "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
48 #endif
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
49 { "normal", NORMAL_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
50 #ifdef BELOW_NORMAL_PRIORITY_CLASS
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
51 { "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
52 #endif
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
53 { "idle", IDLE_PRIORITY_CLASS},
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
54 { NULL, NORMAL_PRIORITY_CLASS} /* default */
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
55 };
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
56
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
57 if (proc_priority) {
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
58 int i;
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
59
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
60 for (i = 0; priority_presets_defs[i].name; i++) {
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
61 if (strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
62 break;
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
63 }
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
64 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_SettingProcessPriority,
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
65 priority_presets_defs[i].name);
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
66
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
67 SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
68 }
3f597aacbb69 Add priority support for OS/2 and factorize the Windows priority support.
diego
parents:
diff changeset
69 }