Package DebTorrent :: Package BT1 :: Module Rerequester :: Class SuccessLock
[hide private]
[frames] | no frames]

Class SuccessLock

source code

Locks to synchronize threaded requests to trackers.

Instance Methods [hide private]
 
__init__(self)
Initialize the instance.
source code
 
reset(self)
Reset the instance to it's initial state.
source code
long
set(self)
Set the lock for a request.
source code
 
trip(self, code, s=True)
Interrupt a not yet finished request.
source code
 
give_up(self)
Terminate a request unsuccessfully.
source code
 
wait(self)
Wait for the current request to complete.
source code
 
unwait(self, code)
Stop waiting for a request to complete.
source code
boolean
isfinished(self)
Check if the current request is complete.
source code
Instance Variables [hide private]
long code
a unique code sent to each setter of the lock
boolean finished
whether the request is complete
boolean first
whether the first trip has occurred yet
threading.Lock lock
lock to ensure no concurrent access to this object
threading.Lock pause
lock to synchronize sending requests to trackers
boolean success
whether the request was successful
Method Details [hide private]

set(self)

source code 
Set the lock for a request.
Returns: long
the unique identifier code for this request

trip(self, code, s=True)

source code 
Interrupt a not yet finished request.
Parameters:
  • code (long) - the unique identifier code for the request
  • s (boolean) - whether to set the request as successful

unwait(self, code)

source code 
Stop waiting for a request to complete.
Parameters:
  • code (long) - the unique identifier code for the request

isfinished(self)

source code 
Check if the current request is complete.
Returns: boolean
whether the request is complete