Thread Priority?
Thread Priority?
- Subject: Thread Priority?
- From: "Nelson Lee" <email@hidden>
- Date: Thu, 20 Sep 2007 18:06:08 -0700
I am currently setting the thread priority of my networking thread as follows and it works!
int set_realtime(int period, int computation, int constraint) {
struct thread_time_constraint_policy ttcpolicy;
struct thread_time_constraint_policy ttcpolicyGet;
int ret;
ttcpolicy.period=period; // HZ/160
ttcpolicy.computation=computation; // HZ/3300;
ttcpolicy.constraint=constraint; // HZ/2200;
//ttcpolicy.preemptible=1;
ttcpolicy.preemptible=0
;
if ((ret=thread_policy_set(mach_thread_self(),
THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t)&ttcpolicy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT)) != KERN_SUCCESS) {
fprintf(stderr, "set_realtime() failed with code %d.\n",ret);
return 0;
}
return 1;
}
and the call is: set_realtime(1250000,60000,90000);
In my thread, I make a networking call using select; more specifically, I am reading from a socket. From timing debug outputs, the reading occurs at regular intervals (~1 ms), but occasionally, the receive call takes 10 ms which throws off my application (it's audio). Is this a networking issue or should setting the priority as real-time take care of this?
Thanks,
-n
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden