Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:20 AM, Astley Le Jasper wrote: When you say don't forget about the GIL, what should I not be forgetting? I'm using sqlite and the following: I mean don't forget that when the GIL is locked, all threads (except the current one, and threads waiting on I/O) will not be able to run.

Re: Noob thread lock question

2009-12-03 Thread Astley Le Jasper
When you say don't forget about the GIL, what should I not be forgetting? I'm using sqlite and the following: <<> thread_lock = threading.RLock() def db_execute(sql): thread_lock.acquire() try: connection = sqlite3.connect(database_name)

Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/3/2009 6:33 AM, Astley Le Jasper wrote: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Just the ones the comes to th

Re: Noob thread lock question

2009-12-03 Thread Astley Le Jasper
Cheers for the responses. ALJ -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob thread lock question

2009-12-02 Thread John Nagle
Diez B. Roggisch wrote: Astley Le Jasper schrieb: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Only the ones coming the

Re: Noob thread lock question

2009-12-02 Thread Diez B. Roggisch
Astley Le Jasper schrieb: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Only the ones coming the the same lock. - I pre

Noob thread lock question

2009-12-02 Thread Astley Le Jasper
I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? - I presume that the answer is b. In which case do the threads stop only if the

Re: thread lock question

2006-10-12 Thread Ritesh Raj Sarraf
I'm sorry. My example code wasn't clear enough. Please see the following: exit_status = copy_first_match(foo, bar) if exit_status == False: if download_file(foo, bar) == True: if zip_bool: ziplock.acquire() try:

thread lock question

2006-10-11 Thread Ritesh Raj Sarraf
Hi, I have a question regarding locks in threads. Following is the code example: if download_file(foo, bar) == True: if some condition: do_something() if zip_bool: ziplock.acquire() try: