Tuesday, May 11, 2010

[android-developers] Re: How to set and get thread priority from Java and native layers

It could be that the thread's ThreadGroup has a maximum priority of 5.
A thread's priority cannot be higher than it's thread-group max-
priority.

It could be that some code you didn't code, but call instead, that
sets the thread priority to 5.

On May 10, 11:37 pm, Krishnakumar Ramachandran
<krishnakumar.ramachand...@gmail.com> wrote:
> I tried that too. But still when I try to query my audio thread's priority,
> it still shows its priority as 5.
>
> On Tue, May 11, 2010 at 8:25 AM, Streets Of Boston
> <flyingdutc...@gmail.com>wrote:
>
>
>
>
>
> > What about Thread.setPriority(...) ?
>
> > That seems to be working for me.
> > When, using the above method, i set the priority of a background-
> > thread too high it has an impact on the GUI (it gets sluggish). It
> > must be doing something...
>
> > On May 10, 9:20 pm, Krishnakumar Ramachandran
> > <krishnakumar.ramachand...@gmail.com> wrote:
> > > Hi has anyone got any idea on this?
>
> > > On Mon, May 10, 2010 at 12:56 PM, KK <
> > krishnakumar.ramachand...@gmail.com>wrote:
>
> > > > I have a multithreaded streaming app which has mainly the following 5
> > > > threads
>
> > > > 1 Main App(UI) Thread
> > > > 1 controller thread (in native)
> > > > 1 audio decoder thread (in native)
> > > > 1 video decoder thread(in native)
> > > > 1 thread to query the head position of audio (in Java)
> > > >  Apart from this I have video rendering with OpenGL.
>
> > > > My problem is, if I query the thread priority using the
> > > > Thread.getPriority method (my native threads make callbacks to Java
> > > > and I am making the query at that point of time), I am getting the
> > > > priority of each of them as 5. For my audio query thread (the last one
> > > > in the list) I am explicitly setting the priority using
> > > > Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
>
> > > > Also for my decoder threads, I am giving higher priority than my
> > > > controller thread(using pthread APIs in native). But still finally all
> > > > of them seem to have same priority.
>
> > > > Can anyone please tell me what is wrong here. Also what should I be
> > > > doing to increase the priority of my threads(both from Java and
> > > > native).
>
> > > > Thanks
> > > > KK
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs­cribe@googlegroups.com>
> > <android-developers%2Bunsubs­cribe@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs­cribe@googlegroups.com>
> > > For more options, visit this group athttp://
> > groups.google.com/group/android-developers?hl=en- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs­cribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en- Hide quoted text -
>
> - Show quoted text -

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment