valid range for thread_policy_set(thread_time_constraint_policy_data_t)

How can an app obtain the valid range for setting thread_time_constraint_policy_data_t for thread_policy_set()?

I don’t think there are any hard constraints on this, but certain combinations are either meaningless or will result in weird failures.

Why are you messing around with the time-contraint policy? I see a lot of folks head down this with for all sorts of wrong reasons. In general, if you’re using the time-constraint policy in the way that it was intended to be user — for work with an actual time constraint — it’s not hard to decide no reasonable values.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you very much, Quinn, We need to set the thread priority for our streaming engine.

Our unit tests are testing its modules - beneath other things - with all kinds of (unrealistic) sample rates. And it tries to set thread priorities for standard sample rates like 44.1kHz, 48kHz, ..., 192kHz, etc. while setting up the streaming engine to run on block sizes from 1 sample to something like 16384, which means the thread needs to be set up for computation down to every 1/44100, 1/192000 sec, etc. IIRC setting the thread_policy below 4/44100 fails.

Although this is (for our current tasks) not a very realistic scenario, I think it should work, at least I would like to know how low the unit tests can go, or even better be able to ask the specific machine about its valid thread_policy range.

Ah, audio, that is the canonically correct place to be using this policy (-:

I would like to know how low the unit tests can go, or even better be able to ask the specific machine about its valid thread_policy range.

You can certainly file an enhancement request for that. [If you do, please post your bug number, just for the record.]

As to what to do right now, my take on this is that you should have your module define its own constraints and then test to those constraints. You might be leaving some flexibility on the floor, but that’s not an uncommon drawback for an abstraction layer.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

valid range for thread_policy_set(thread_time_constraint_policy_data_t)
 
 
Q