[Petal] [PATCH] Options via constructor rather than package
globals
Fergal Daly
fergal at esatclear.ie
Fri Jun 6 17:29:10 BST 2003
On Thursday 05 June 2003 3:01 pm, Jean-Michel Hiver wrote:
> > I think this pretty much guarantees that using these features with threads
is
> > not safe. I'm not sure how many people will want to use Petal with threads
> > but...
>
> I think it'll be fine. But I might be wrong :)
>
> http://perldoc.com/perl5.8.0/pod/perlthrtut.html#Thread-Safe-Modules
>
It'll be safe as long as Petal is only used by 1 thread but the problem is if
2 threads are in the Petal routines at the same time, which configuration
will they see? Actually, if the variables are completely unshared then
everything will be OK but I presume there are some variables in Petal that
you do want to share, like default config values etc. so now you have to
decide which variables will be shared and which are not. The ones that are
shared are global values, the ones that aren't are basically the instance
values for each Petal object so you're using object orientation without using
objects.
If you think it'll be lots of work, back out patch for multiple configs and
slowly migrate (1 global variable at a time) to a pure object setup. Then the
patch becomes trivial,
F
More information about the Petal
mailing list