Re: External symbols and lists across forks, again

2011-07-25 Thread Alexander Burger
Hi Henrik,

 Sorry for the wording, non-existent would have been better.
 
 The thing is I'm not able to access the objects if they are stored in a list
 in the parent, eg (setq *Objs (collect ... )), if I then do (show (car
 *Objs)) in the child process I get NIL.

There must be some fundamental misunderstanding here.


Let's do this: Edit in family.l from the distribution (after unpacking
doc/family.tgz or doc/family64.tgz) the 'go' function:

   (de go ()
  (rollback)
  (setq *Objs (collect 'nm '+Person))  # Inserted this line
  (server 8080 !person) )

'*Objs' is set in the parent, as 'server' will do the first 'fork'.


Then I start the server

   $ pil family.l -main -go +

connect the browser to localhost:8080, and at the resulting prompt (we
are in the child, right?):

   : (show (car *Objs))
   {2-o} (+Man)
  ma {2-j}
  fin 711698
  dat 688253
  nm Adalbert Ferdinand Berengar Viktor of Prussia
  pa {2-h}
   - {2-o}

or

   : (more *Objs show)
   {2-o} (+Man)
  ma {2-j}
  fin 711698
  dat 688253
  nm Adalbert Ferdinand Berengar Viktor of Prussia
  pa {2-h}
 
   {2-1L} (+Man)
  mate {2-1M}
  nm Adam

   {2-1B} (+Man)
  kids ({2-1C} {2-1D} {2-1E} {2-1F} {2-1G} {2-1H} {2-1I} {2-g} {2-a})
  nm Albert Edward
  job Prince
  mate {2-f}
  fin 680370
  dat 664554

   {2-b} (+Man)
  ma {2-Y}
  nm Albert Victor
  dat 680760
  pa {2-a}
  fin 690991
   ...

Voila! :)

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: External symbols and lists across forks, again

2011-07-16 Thread Alexander Burger
Hi Henrik,

 I just noticed that external symbols are only accessible in a forked
 http server instance if they are directly stored in a variable, e.g.
 (setq *Obj (db ... )), however if they are stored in a global list
 they seem to be inaccessible or?

Sorry, it looks like I don't understand the question.

In general, a forked child process inherits everything from the parent,
including all symbols (intern, transient and extern) and data structures
global and local variable bindings, properties etc.

What do you mean with inaccessible? Fetching them with a lisp function
like 'db' or 'collect', and/or with Pilog predicates?

Also the state of the cache is passed to the child, i.e. symbols fetched
by the parent, and thus currently resident in memory, are also found
resident by the child.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe