Re: How to thread in Perl?

2002-04-21 Thread Chas Owens
On Fri, 2002-04-19 at 21:38, Ahmed Moustafa wrote: Chas Owens wrote: my $terminate = 0; $SIG{TERM} = sub { $terminate = 1 }; until ($terminate) { #do stuff } #cleanup You should definitely provide some means of cleanly bring down your daemon. Cleaning up is

Re: How to thread in Perl?

2002-04-21 Thread drieux
On Sunday, April 21, 2002, at 08:09 , Chas Owens wrote: [..] The daemon should not come down until all of its children are finished. That is why you need intercept SIGTERM. [..] technically the correct structure for RFC compiance is The daemon MUST NOT come down until all of its

Re: How to thread in Perl?

2002-04-19 Thread Chas Owens
On Thu, 2002-04-18 at 18:28, drieux wrote: On Thursday, April 18, 2002, at 02:27 , Ahmed Moustafa wrote: Chas, Thanks a lot! #the main loop has exited, so we should check to see if there are #any unreaped children waitpid $_ for keys %running; My main loop is iterating

Re: How to thread in Perl?

2002-04-19 Thread drieux
On Friday, April 19, 2002, at 07:03 , Chas Owens wrote: On Thu, 2002-04-18 at 18:28, drieux wrote: [..] you might want to have your 'main loop' in our $still_going = 1; $SIG{TERM} = sub { $still_going = 0 }; # correcting Chas's Issues... 8-) while ( $still_going ) { # the main loop

Re: How to thread in Perl?

2002-04-19 Thread Chas Owens
On Fri, 2002-04-19 at 11:53, drieux wrote: On Friday, April 19, 2002, at 07:03 , Chas Owens wrote: On Thu, 2002-04-18 at 18:28, drieux wrote: [..] you might want to have your 'main loop' in our $still_going = 1; $SIG{TERM} = sub { $still_going = 0 }; # correcting Chas's Issues...

Re: How to thread in Perl?

2002-04-19 Thread Ahmed Moustafa
Chas Owens wrote: my $terminate = 0; $SIG{TERM} = sub { $terminate = 1 }; until ($terminate) { #do stuff } #cleanup You should definitely provide some means of cleanly bring down your daemon. Cleaning up is application specific, isn't? Or, is there a standard procedure? How

Re: How to thread in Perl?

2002-04-18 Thread Ahmed Moustafa
Chas, Thanks a lot! #the main loop has exited, so we should check to see if there are #any unreaped children waitpid $_ for keys %running; My main loop is iterating forever i.e. a daemon; thus, any code after the main loop will not be executed. So, what do you think? Once again, thanks.

Re: How to thread in Perl?

2002-04-18 Thread drieux
On Thursday, April 18, 2002, at 02:27 , Ahmed Moustafa wrote: Chas, Thanks a lot! #the main loop has exited, so we should check to see if there are #any unreaped children waitpid $_ for keys %running; My main loop is iterating forever i.e. a daemon; thus, any code after the main loop

Re: How to thread in Perl?

2002-04-17 Thread Ahmed Moustafa
You are better off trying $SIG{CHLD} = 'IGNORE'; at the top of your program and seeing if zombies are left out there. If so then you might want to use pop or shift like this waitpid shift @children while @children; Do I really need to hold the pid's of the kids process somewhere? Can't

Re: OT: Old uunet gag was Re: How to thread in Perl?

2002-04-16 Thread Jonathan E. Paton
[..] Missile Address: 33:48:3.521N 84:23:34.786W By the way, what is the Missile Address? that is the lattitude and longitude of where the server is suppose to be located - an old habit from the UUNET entries into the UUMAPS - that has held on by some in essence, if you really

Re: OT: Old uunet gag was Re: How to thread in Perl?

2002-04-16 Thread Ahmed Moustafa
Is there a way to know the Missile Address from an IP address? -- Ahmed Moustafa http://pobox.com/~amoustafa -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to thread in Perl?

2002-04-15 Thread Ahmed Moustafa
#reap the children to avoid zombies waitpid $_ for (@children); Do I need to pop the pid's from the stack children? Thanks, Ahmed -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to thread in Perl?

2002-04-15 Thread Chas Owens
On Mon, 2002-04-15 at 17:31, Ahmed Moustafa wrote: #reap the children to avoid zombies waitpid $_ for (@children); Do I need to pop the pid's from the stack children? Thanks, Ahmed You are better off trying $SIG{CHLD} = 'IGNORE'; at the top of your program and seeing if zombies

Re: How to thread in Perl?

2002-04-15 Thread Ahmed Moustafa
You are better off trying $SIG{CHLD} = 'IGNORE'; at the top of your program and seeing if zombies are left out there. There were no zombies left after the program termination. Then, I don't need even to push the ids from the children in the stack, right? Missile Address: 33:48:3.521N

Re: How to thread in Perl?

2002-04-15 Thread Ahmed Moustafa
You are better off trying $SIG{CHLD} = 'IGNORE'; at the top of your program and seeing if zombies are left out there. There were no zombies left after the program termination. Then, I don't need even to push the ids from the children in the stack, right? Something happened when I

Re: How to thread in Perl?

2002-03-28 Thread Chas Owens
On Wed, 2002-03-27 at 20:40, Ahmed Moustafa wrote: Chas Owens wrote: I wrote some experimental code and it looks like you don't have to reap the children (maybe this is just a C thing). So, is it OK to fork processes without using waitpid? In general, how are the servers (from the fork

FW: How to thread in Perl?

2002-03-27 Thread Richard Smith
in perl? I couldn't find anything, unless system() is used somehow. Thanx, Smiddy -Original Message- From: Chas Owens [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 5:08 PM To: Ahmed Moustafa Cc: [EMAIL PROTECTED] Subject:Re: How to thread in Perl? I wrote some

Re: How to thread in Perl?

2002-03-27 Thread Ahmed Moustafa
Chas Owens wrote: I wrote some experimental code and it looks like you don't have to reap the children (maybe this is just a C thing). So, is it OK to fork processes without using waitpid? In general, how are the servers (from the fork perspective - multithreading handling -) implemented in

Re: How to thread in Perl?

2002-03-26 Thread Jim Conner
At 22:14 03.25.2002 -0800, Ahmed Moustafa wrote: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 209.178.174.150 Jim Conner wrote: At 20:28 03.25.2002 -0800, Ahmed Moustafa wrote: Jim Conner wrote: I suck at this kind of topic but

Re: How to thread in Perl?

2002-03-26 Thread Chas Owens
On Tue, 2002-03-26 at 01:14, Ahmed Moustafa wrote: Jim Conner wrote: At 20:28 03.25.2002 -0800, Ahmed Moustafa wrote: Jim Conner wrote: I suck at this kind of topic but the only way I can think of doing such a thing is this: Use IPC. fork off something like 10 children each

Re: How to thread in Perl?

2002-03-26 Thread perl
Is there a limit to the number of children in Perl? Ahmed Moustafa [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Tagore Smith wrote: Ahmed Moustafa wrote: So, how can a new different process by forked? Or, how a function be called and the next step

Re: How to thread in Perl?

2002-03-26 Thread Chas Owens
To my knowledge the only limit is what your OS can handle. On Tue, 2002-03-26 at 14:53, perl wrote: Is there a limit to the number of children in Perl? Ahmed Moustafa [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Tagore Smith wrote: Ahmed Moustafa

Re: How to thread in Perl?

2002-03-26 Thread Ahmed Moustafa
Chas, thanks a lot for your example. if the while loop is inside a main infinite loop (as if it was a daemon), do I still need to have the waitpid function? and if yes, where should be located? Once again, thanks a lot! Chas Owens wrote: On Tue, 2002-03-26 at 01:14, Ahmed Moustafa wrote:

Re: How to thread in Perl?

2002-03-26 Thread Chas Owens
I wrote some experimental code and it looks like you don't have to reap the children (maybe this is just a C thing). On Tue, 2002-03-26 at 15:56, Ahmed Moustafa wrote: Chas, thanks a lot for your example. if the while loop is inside a main infinite loop (as if it was a daemon), do I still

How to thread in Perl?

2002-03-25 Thread Ahmed Moustafa
How can I thread a function in Perl? Any help will be appreciated so much. Regards, -- Ahmed Moustafa http://pobox.com/~amoustafa -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to thread in Perl?

2002-03-25 Thread Matthew Harrison
What exactly do you mean by 'thread'? On Mon, 25 Mar 2002, Ahmed Moustafa wrote: How can I thread a function in Perl? Any help will be appreciated so much. Regards, -- Matthew Harrison Internet/Network Services Administrator Peanut-Butter Cheesecake Hosting Services Genestate

Re: How to thread in Perl?

2002-03-25 Thread Ahmed Moustafa
Matthew Harrison wrote: What exactly do you mean by 'thread'? I've a loop which scans directories looking for files and processes the existing files. I'd like process each file independently (i.e. in parallel) rather than sequentially. On Mon, 25 Mar 2002, Ahmed Moustafa wrote: How

Re: How to thread in Perl?

2002-03-25 Thread Jim Conner
I suck at this kind of topic but the only way I can think of doing such a thing is this: Use IPC. fork off something like 10 children each child working on a separate file and use sysvmsg sysvshem (I do not believe these are functions and I can't look the right functions up for you right now

Re: How to thread in Perl?

2002-03-25 Thread Ahmed Moustafa
Jim Conner wrote: I suck at this kind of topic but the only way I can think of doing such a thing is this: Use IPC. fork off something like 10 children each child working on a separate file and use sysvmsg sysvshem (I do not believe these are functions and I can't look the right

Re: How to thread in Perl?

2002-03-25 Thread Ahmed Moustafa
Jim Conner wrote: I suck at this kind of topic but the only way I can think of doing such a thing is this: Use IPC. fork off something like 10 children each child working on a separate file and use sysvmsg sysvshem (I do not believe these are functions and I can't look the right

Re: How to thread in Perl?

2002-03-25 Thread Jim Conner
At 20:28 03.25.2002 -0800, Ahmed Moustafa wrote: Jim Conner wrote: I suck at this kind of topic but the only way I can think of doing such a thing is this: Use IPC. fork off something like 10 children each child working on a separate file and use sysvmsg sysvshem (I do not believe these are

Re: How to thread in Perl?

2002-03-25 Thread Ahmed Moustafa
Tagore Smith wrote: Ahmed Moustafa wrote: So, how can a new different process by forked? Or, how a function be called and the next step execute without waiting for the previous function to terminate? For your original question (threads) see perldoc perlthrtut. When you fork a