|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Killing Fork()
I have an import with a fork() in the AfterMenuLoad area. When the menu is closed (in this case the MediaPlayer OSD) does the fork() automatically get killed or do I need to do it manually? If it's not getting killed is it possible it would cause a memory leak?
|
#2
|
|||
|
|||
Does the fork have a loop under it where it keeps looping? Or does it end? It is me understanding the fork simply allows a process to run in the background and allow other code/process to run in the foreground
Of course I could misunderstand but I know the fork will end once the code below is executed unless is loops somewhere |
#3
|
||||
|
||||
Currently there is code under it to update a panel on the OSD every minute to show the time. It doesn't have anything built-in to end it, because I was hoping that when the OSD menu was ended by ending a show it would just go away. Now I'm beginning to think I need a way to end the fork manually if the OSD is closing.
Last edited by toricred; 07-26-2009 at 04:53 PM. |
#4
|
||||
|
||||
A forked thread won't end automatically, especially if is in a loop, so you'll need to add some sort of check to determine whether to keep it going, or let it end. The defaul STV does quite a few forked loops in AfterMenuLoad hooks, so you could check some of them out if you need ideas about how to have it end when the menu exits.
- 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. |
#5
|
||||
|
||||
How about a panel widget? Does it get killed when the OSD is killed? If so, I could just check to see if it still exists.
|
#6
|
||||
|
||||
I decided to use HasMediaFile(), but I don't know how to be sure it worked. I can't tell that the fork has died in any way I can think of.
|
#7
|
||||
|
||||
Basically the structure of your code should be something like this:
Code:
Fork() ...initialize... If KeepLooping() ...do something... If KeepLooping() ...cleanup... To make sure it's working right, put some calls to DebugLog() in the initialize, loop body, and cleanup sections of the code so you can see the control flow. Keeping a handle on the Panel widget won't tell you when it's been freed, since it won't be freed as long as you have a handle on it. BeforeMenuUnload is your signal that the menu is being unloaded, and it's up to you to propagate that signal to any forked threads you've created.
__________________
-- Greg |
#8
|
|||
|
|||
Quote:
If HasMediaFile() true run your refresh or whatever you are doing false DebugLog("Message") |
#9
|
|||
|
|||
Man this was not there when I posted above
|
#10
|
||||
|
||||
It turns out that the MC MediaPlayer Menu already has a variable being set in the BeforeMenuUnload area named forkstop. I just used that. I haven't done anything with the debugging yet, but I'll work on it later this week.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sage is killing samba server | glenhein | SageTV Software | 2 | 02-14-2007 08:54 PM |
Fork() | Bohica | SageTV Studio | 3 | 03-25-2006 01:05 PM |
IR is killing my hard drive :( | bigbbri | SageTV Software | 27 | 05-08-2004 02:47 PM |