abstractly creating something non-abstract / concrete seems inherently
problematic;
I wonder why you need a namespace? Is there a reason you can't just spin up
a new object with each fork that will execute your child behavior?

I'm thinking some combination of factory & flyweight pattern

I'm not sure what you intend with your namespacing, but a new object should
give you something globally unique.
e.g. instantiating a new child object once you're in the child process...

Maybe some variation of this could work.

$pid = pcntl_fork();
if ($pid == -1) {
     die('could not fork');
} else if ($pid) {
     // we are the parent
     pcntl_wait($status); //Protect against Zombie children
} else {
     // we are the child
     $child = new Child($config);
     $child->do_something();
}


-Jason

On Sat, Sep 29, 2012 at 1:48 PM, Wade Shearer <[email protected]>wrote:

> I have a foreach in which I use pcntl_fork to fork off an independent
> process. This is so that thinks can be executed non-linearly. I want to
> define a constant immediately after the fork. My script fails however
> stating it cannot define the constant because it is already defined (the
> second loop in the foreach I assume). Is there a way for the fork to
> maintain a unique global namespace?
>
> _______________________________________________
>
> UPHPU mailing list
> [email protected]
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to