------art_22413_26762744.1206576560537
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I see,
I have a class to handle interfacing to the database. The initialization of
the class will connect to the db and another method will close the
connection and there are query functions for handling the queries and
results. This object is then passed into new objects on their
initialization. The problem comes in when I iterate through a set of objects
creating a fork for each one. After the first object I am getting a
"database went away error". My code looks like the following:

db  ySQL.new

fork do
  obj1  bject1.new(db)
  obj1.addToDb
end
Process.wait

fork do
  obj2  bject2.new(db)   #Object1 and Object2 are inherited from the same
superclass
  ob2.addToDb   #db error occurs here
end
Process.wait

db.closeDB

--output--
obj1 info added to db!
Error message: MySQL server has gone away

I know I am missing a key concept here. This is the first time I have worked
with forked processes.

On Wed, Mar 26, 2008 at 7:39 PM, Joel VanderWerf <vjoel / path.berkeley.edu>
wrote:

> Joey Marino wrote:
> > I want to fork a child process and use instantiated objects from the
> parent
> > process. Is this possible?
> >
> > obj  bject.new
> >
> > fork do
> >   doSomething(obj)
> > end
>
> Yes, but it is a _copy_ of the original, so modifications in the child
> don't affect the parent.
>
> --
>       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
>
>


-- 
Joey Marino

------art_22413_26762744.1206576560537--