Did you try out your "best solution"? Because I fail to see
how this is supposed to work. As soon as you fork,
your data (that is, your variables), are copied - that is,
both the parent and the child get a copy, and they do not
share the variables.
But you mentioned threads, so, unlike the original poster,
you might use threads instead of forks. Then variables can
be shared. However, if two threads can access the same
variable, you will need locking on the variable - which means
to avoid locking, you will need to do locking.
-- Abigail | [reply] [d/l] |