Re: Do I need a lock here?

2008-10-28 Thread Aaron Brady
On Oct 28, 3:29 pm, jasiu85 <[EMAIL PROTECTED]> wrote: > On Oct 27, 10:12 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > jasiu85 schrieb: > > > > Hey, > > > > Please take a look at the code of the two threads below: > > > > COMMON_DICT = {} > > > > def thread_1(): > > >     global COMM

Re: Do I need a lock here?

2008-10-28 Thread jasiu85
On Oct 27, 10:12 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > jasiu85 schrieb: > > > > > Hey, > > > Please take a look at the code of the two threads below: > > > COMMON_DICT = {} > > > def thread_1(): > >     global COMMON_DICT > >     local_dict = prepare_dict() > >     COMMON_DICT = local

Re: Do I need a lock here?

2008-10-27 Thread Michael Sparks
jasiu85 wrote: > Do I need a lock to protect the COMMON_DICT dictionary? AFAIK bytecode > operations are atomic and in each thread there's only one crucial > bytecode op: STORE_NAME in the first thread and LOAD_NAME in the > second one. So I suspect that everything will work just fine. Am I > righ

Re: Do I need a lock here?

2008-10-27 Thread Duncan Booth
jasiu85 <[EMAIL PROTECTED]> wrote: > Hey, > > Please take a look at the code of the two threads below: > > COMMON_DICT = {} > > def thread_1(): > global COMMON_DICT > local_dict = prepare_dict() > COMMON_DICT = local_dict > > def thread_2(): > global COMMON_DICT > local_dic

Re: Do I need a lock here?

2008-10-27 Thread Diez B. Roggisch
jasiu85 schrieb: Hey, Please take a look at the code of the two threads below: COMMON_DICT = {} def thread_1(): global COMMON_DICT local_dict = prepare_dict() COMMON_DICT = local_dict def thread_2(): global COMMON_DICT local_dict = COMMON_DICT use_dict(local_dict) Do

Do I need a lock here?

2008-10-27 Thread jasiu85
Hey, Please take a look at the code of the two threads below: COMMON_DICT = {} def thread_1(): global COMMON_DICT local_dict = prepare_dict() COMMON_DICT = local_dict def thread_2(): global COMMON_DICT local_dict = COMMON_DICT use_dict(local_dict) Do I need a lock to pr