|Think about Loose Coupling|
Using Thread::Conveyor and Parallel::ForkManagerby Asgaroth (Novice)
|on Aug 09, 2004 at 07:30 UTC||Need Help??|
Asgaroth has asked for the
wisdom of the Perl Monks concerning the following question:
I would appreciate some of the infinite wisdom that is at the Monestry Gates.
Firstly, is it at all possible to use a combination of the Thread::Conveyor module and the Parallel:ForkManager module? I am assuming that this is indeed possible.
Secondly, how would I use this in a thread "consumer" subroutine?
Basically I have a thread that is constantly being populated with locations of filenames. These files then need to be compressed. The thread "consumer" is working just fine, it compresses all these files, however, I need to perform multiple compressions at once, i am hoping to achieve this by implementing the Parallel::ForkManager module within the "consumer" thread.
The code for the subrouting follows:
If I comment out all the Parallel::ForkManager related statements, this subroutine works as it should, if I have them in as posted above then it does not appear to compress anything.
Am I missing something obvious here, or is there some fundamental design flaw in the above code?
Dont worry about the reading od the datafiles into memory then flushing to disk, the system that this is running on is more than capable of handling the memory requirements. However, suggestions would be appreciated on how to improve the above subroutine. Most of it is just queueing to another thread which writes logs to a file.
Your help in this would be *greatly* appreciated.