Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: •Re: Re: Logical Conundrum (processes)

by mcogan1966 (Monk)
on Dec 01, 2003 at 19:18 UTC ( [id://311372]=note: print w/replies, xml ) Need Help??


in reply to •Re: Re: Logical Conundrum (processes)
in thread Logical Conundrum

$0 may be unique to the script, but that is a BIG problem. What I have is a main program (parent) spawning a number of child programs. Each of the child programs is trying to print to <STDOUT>. What I am having is when 2 children are trying to print to <STDOUT> at the same time, the information gets mixed. By trying to set flock(), I am trying to prevent one child from printing to <STDOUT> while another child is in the middle of doing that. The end result should be that I don't have any mixed outputs.

Problem is, the traditional uses of flock() aren't helping, they are creating either the same problem with the output, or they are creating runaway processes.

I've created a file, "lock_file". I have a lock_ex subroutine that returns a file handle when it can create an exclusive lock. I need to check to see if that is in place, if so wait, if not go ahead and print to <STDOUT>.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://311372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found