in reply to Re: use threads for dir tree walking really hurts
in thread use threads for dir tree walking really hurts
Why are you doing that?Because when an object fall into a thread scope, the object will be cloned, which is not the one I want. And since threads don't share object / complex data structure ( and I don't what to share them one by one ), this trick do share the object perfectly... until it's not.
Actually, I can do the job with simply: @dirToFetch : shared, but same issue Thread::Queue, I gotta leave it at a nested package scope , but create it inside an object become another mess to share around threads. Because I attempt to make it a module, so I hope to avoid if other script calling this module in threads, the data will mess up.
Though, I've update my OP's code, which will work and as fast as dir /s/b I create as many threads as how much in @dirToFetch
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use threads for dir tree walking really hurts
by Corion (Patriarch) on Sep 01, 2016 at 14:08 UTC |