in reply to Re: IO::Uncompress::Gunzip thread safe?
in thread IO::Uncompress::Gunzip thread safe?
It was just the simplest way I can reproduce the problem. The actual script will start a thread for each chunk, enqueue the thread handle, then continue reading, start another thread, queue the thread handle, etc. The number of threads are limited with a semaphore, down'ed with each thread creation. Each thread performs some work on each record in the chunk it was sent. A separate output thread will dequeue the thread handle, join it receiving the processed output as a returned array reference, up the semaphore, and write the output to a file in the same order it was read. It works quite well with uncompressed input.
As a workaround for the compression, I had started a thread before loading the compression libraries, then used a queue to send the data to that thread from the input thread, but it was MUCH SLOWER.
Unfortunately I had to disable support for compressed input. Compressed output still works since that thread doesn't start any other threads.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IO::Uncompress::Gunzip thread safe?
by Corion (Patriarch) on Nov 21, 2016 at 20:42 UTC | |
by chris212 (Scribe) on Nov 21, 2016 at 21:55 UTC | |
by BrowserUk (Patriarch) on Nov 21, 2016 at 23:27 UTC | |
by chris212 (Scribe) on Nov 22, 2016 at 15:11 UTC | |
by BrowserUk (Patriarch) on Nov 22, 2016 at 15:42 UTC | |
by soonix (Chancellor) on Nov 22, 2016 at 19:04 UTC | |
by afoken (Chancellor) on Nov 22, 2016 at 21:30 UTC | |
| |
by Corion (Patriarch) on Nov 22, 2016 at 08:12 UTC |