En Fri, 28 Mar 2008 12:25:55 -0300, <[EMAIL PROTECTED]> escribió:
> On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
> wrote:
>> En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió:
>>
>> > How can this module access global state (not per-thread state) ?
>> > It needs to create a singleton.
>>
>> C global variables are global, not per-thread.
>
> Yes, but they get initialized once per-thread, therefore my singleton
> gets
> created multiple times.
Either don't call the initialization from every thread, or guard it with
something like:
a_big_object my_object = NULL;
...
if (my_object!=NULL) {
...initialize object...
my_object = ...;
}
That's a pretty standard idiom I think.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list