Henry,
Read the Perl documentation for more background on ithreads. ('perldoc
perlthrtut').
One solution could be to declare a global Thread::Queue. The worker threads
would input data into the queue and the parent thread would pull data
records out of the queue and write it to a file. The worker threads will
need a locking mechanism around the queue insert part. This solution is
likely only viable when the worker threads are doing a limited amount of
inserts into the queue.
-Craig
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On
>Behalf Of henry isham
>Sent: Tuesday, August 17, 2004 13:24
>To: [EMAIL PROTECTED]
>Subject: FW: Threading 101
>
>
>Hi all,
>
>I have a script with multiple subs that are independent of
>each other and can run simultaneously. So, I'm thinking of
>threading them. However, each sub writes output to the same
>file. Now, they run sequentially, so that isn't a problem.
>What considerations should I keep in mind when threading these
>subs? Should I just have them output to separate text files
>and then consolidate those files before my parsing starts? Or
>is there a way to have all the threads write to the same file
>without stepping on each other's output?
>
>Thanks in advance for any and all help.
>
>-Henry
>
>
>
>
>
>_______________________________________________
>Perl-Win32-Admin mailing list [EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs