Fix pd tilde
This should make it possible to use [pd~] with [stdout] when running the child pd instance with the -nogui flag.
This selectively ports a few changes from Pd Vanilla in order to get it to work. It affects the way realtime priorities get set, so that should probably be tested before merging this.