On Friday 06 August 2004 13:45, Bruno Tavares wrote:
> Which reminds me of something: we are currently implementing the ability
> to stop a burning process.
The most difficult part in my case :-)

> I noticed that you have some special methods that freevo is supposed to
> call in order to shutdown a instance of your plugin. Can you please tell
> me which ones are methods with that purpose and in which occasions
> freevo calls them?
Just define a method called 'shutdown' in your plugin interface and freevo 
calls it automatically at shutdown. In my case, this shutdown method calls a 
shutdown method in my thread to terminate it silently.

> Thanks for all the time saving in threads coding ;)

Some notes about thread/child handling in freevo :

- All childs spawned in a thread must be spawn by the main thread in order to 
keep control on it (freevo has a workaround by sending an event 
OS_EVENT_POPEN2 to the main thread in util/popen3.py)

- When you spawn a child with pipes (|), python spawns a shell with a subshell 
for each pipe : you loose control over these subshells. The only 'clean' way 
I found of doing this, is to force the spawned shell to be a process group 
leader. I achieve this by adding to util/popen3.py the line :
    os.setpgid(0, os.getpid())
Then you can kill the whole process tree created by the shell...

I tried not to use pipes directly in child processes, but the way python is 
handling pipes is too complicated in my case (I have a lot of pipes) and the 
code becomes quickly unreadable...

If someone has a clean method to spawn multiple commands in pipes in python, I 
would be happy to convert my code to the python way...

Good luck,

Nicolas.


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Freevo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to