[PD] pthread_setschedparam problem on OSX + fix
cgc
cgc at humboldtblvd.com
Sun Nov 23 22:18:21 CET 2003
I've been meaning to post this change for a long time, and have been
negligent about it.
The pthread_setschedparam() hack that helps pd's audio not drop on OSX
is absolutely fatal when used with GEM. The reason for this is that
OSX uses OpenGL for the entire UI and GL requires context switches to
handle multiple applications sharing the hardware. When Pd sets it's
pthread priority higher than the UI, this context switch can be blocked
resulting in a complete lockout of UI events as GEM grabs all the CPU
resources and refuses to relinquish the context.
The fix is to add the -rt option as prerequisite and not make this the
default action (a check to make sure GEM is not loaded would be good to
have as well):
#ifdef MACOSX
if (sys_hipriority)
{
struct sched_param param;
int policy = SCHED_RR;
int err;
param.sched_priority = 80; // adjust 0 : 100
post("pd: real-time mode - using pthread_setschedparam\n");
err = pthread_setschedparam(pthread_self(), policy, ¶m);
if (err)
post("warning: high priority scheduling failed\n");
}
#endif /* MACOSX */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1614 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20031123/7db4ce9d/attachment.bin>
More information about the Pd-list
mailing list