Re: Infinite loops and synchronization

2009-07-14 Thread Aahz
In article , Vincent Gulinao wrote: > >lst = list() > >while True: > if len(lst) == SOME_NUMBER: > return lst > >Q2: operating on list from threads (mostly appends) must be safe, >right (synchronization)? What do you mean by "safe"? Python certainly won't crash, but there's

Re: Infinite loops and synchronization

2009-07-13 Thread Lawrence D'Oliveiro
In message , Vincent Gulinao wrote: > Q1: is this a common OK practice? I'm worried infinite loops hogs memory. The problem is not that the loop is infinite, but that it busy-waits, hogging CPU. -- http://mail.python.org/mailman/listinfo/python-list

Re: Infinite loops and synchronization

2009-07-13 Thread pdpi
On Jul 13, 6:06 am, Vincent Gulinao wrote: > lst = list() > > (lst populated by async twisted deferred callbacks) > > while True: >         if len(lst) == SOME_NUMBER: >                 return lst > > Q1: is this a common OK practice? I'm worried infinite loops hogs memory. > Q2: operating on list

Re: Infinite loops and synchronization

2009-07-13 Thread Piet van Oostrum
> Vincent Gulinao (VG) wrote: >VG> lst = list() >VG> (lst populated by async twisted deferred callbacks) >VG> while True: >VG>if len(lst) == SOME_NUMBER: >VG>return lst >VG> Q1: is this a common OK practice? I'm worried infinite loops hogs memory. >VG> Q2: operating on list

Infinite loops and synchronization

2009-07-12 Thread Vincent Gulinao
lst = list() (lst populated by async twisted deferred callbacks) while True: if len(lst) == SOME_NUMBER: return lst Q1: is this a common OK practice? I'm worried infinite loops hogs memory. Q2: operating on list from threads (mostly appends) must be safe, right (synchroni