condition.acquire vs lock.acquire

jayshankar nair n_jayshankar at yahoo.com
Tue Mar 27 02:09:59 EDT 2018


Hi,
Is condition.acquire(threading.Condition()) similar to lock.acquire(threading.Lock). Does both of get access to the lock. Can i use condition.wait,notify with lock.acquire or i have to use condition.wait, notify with condition.acquire.
cond.acquire()  // can i replace with lock.acquire

   while count[ipID]> 1:
      cond.wait()
   if ipID == 0:
      time.sleep(10)


   count[ipID] = count[ipID] + 1


   cond.release() // can i replace with lock.release

Thanks,Jayshankar



More information about the Python-list mailing list