SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-2009, 02:04 PM
cracklepopflash cracklepopflash is offline
Sage User
 
Join Date: Aug 2009
Location: Sunnyvale
Posts: 26
Thread Priority?

So I used the Fork() method to start a thread once the application starts. However, it seems to cause the UI to lag (meaning that navigating around the menu is really slow). Is there a way to adjust thread priorities, so that UI thread(s) get higher priority and maybe it won't lag as much?
Reply With Quote
  #2  
Old 12-08-2009, 02:18 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
In the default STV, search for java_lang_Thread_setPriority for some examples.

If possible, put some pauses in the forked threads, or wait for user input inactivity before doing the work, then pause again if user activity starts. You can use GetTimeSinceLastInput() to determine the amount of time since the last user input occurred.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #3  
Old 12-09-2009, 06:05 PM
cracklepopflash cracklepopflash is offline
Sage User
 
Join Date: Aug 2009
Location: Sunnyvale
Posts: 26
I see. When you say to put "pauses in the forked thread", do you mean to call the Wait function?

Thanks for your help.
Reply With Quote
  #4  
Old 12-09-2009, 08:03 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Yes, Wait() is what he means. As a general rule of thumb, most forked threads should spend most of their time inside Wait() waiting for something to happen.

Alternatively, if your forked thread is waiting for some specific user action, you might consider forking a new thread each time that action is performed and letting those threads do their thing and then exit without looping.

If you actually have some background task that requires continuous computation over a long period of time, that's when lowering the thread priority would be appropriate.

Maybe if you give us some idea of what you're trying to accomplish with your forked thread, we can give more specific advice on how to accomplish it.

Also note that ApplicationStarted may not be the best place to fork off your thread, since that happens just once when SageTV is started, and not (for instance) when the user loads a new STV in mid-session. A better place to do that sort of one-time global initialization is in the Main Menu's BeforeMenuLoad hook. You'd need to check a flag to see if it's been done once already, and if not, do the init (i.e. fork your thread or whatever) and then set the flag to indicate that it's been done. That way you cover all possible paths by which your STV might be invoked.
__________________
-- Greg
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tuner Priority jgourd SageTV Software 7 02-04-2009 06:58 PM
Priority 150ht SageTV Software 0 12-23-2006 12:02 PM
Any way to set priority? Mortanis SageTV Software 8 01-12-2006 08:49 PM
Above Normal Priority kny3twalker SageTV Software 16 03-18-2005 08:42 AM
How To Set Thread Priority for SageTV beckerhead SageTV Software 10 01-12-2005 06:34 PM


All times are GMT -6. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.