Implement THREAD_PRIORITY_TIME_CRITICAL
Andreas Mohr
andi at rhlx01.fht-esslingen.de
Fri Mar 31 07:21:51 CST 2006
Hi,
On Fri, Mar 31, 2006 at 02:06:23PM +0100, Mike Hearn wrote:
> This patch gives me rock solid audio in Imperium Galactica 2, so now the
> game works perfectly.
>
> There has been discussion around this issue with respect to security in
> the past, however, regardless of what approach is adopted this code will
> have to be written anyway.
Ah, thanks, nice to see that it actually helps.
> + scheduler = SCHED_FIFO;
IMHO we should really add some smart detection of SCHED_ISO kernel capability
and *much* prefer to use that one then. One really wouldn't want to hang
the box...
Not to mention that SCHED_FIFO requires root, which is an absolute PITA.
Nice To Have would be support for stuff such as SCHED_IDLEPRIO and
SCHED_BATCH...
> + if (result == -EPERM)
> + {
> + static int need_warning = 1;
> +
> + if (need_warning)
> + {
> + fprintf( stderr, "\nwineserver: Failed to promote the priority of a time critical thread.\n" );
> + fprintf( stderr, "Audio may destabilise. To fix this re-run the application as root.\n\n" );
> + need_warning = 0;
> + }
> +
> + return;
> + }
Make that
static int already_warned; /* static: = 0! */
Since static uses 0 as default and you don't want to waste space in the
.bss(?) segment for an explicit 1 init.
Andreas Mohr
--
No programming skills!? Why not help translate many Linux applications!
https://launchpad.ubuntu.com/rosetta
(or alternatively buy nicely packaged Linux distros/OSS software to help
support Linux developers creating shiny new things for you?)
More information about the wine-devel
mailing list