Generic stoppable thread
Project description
qThread provides an simplified and safe way to stop long running threads. Typical uses often look like this:
# Test / Usage of the stoppable thread
class MyThreadingClass(StoppableThread):
def __init__(self, a):
super(MyThreadingClass, self).__init__()
self.a = a
self.b = "World"
self.delay = .5 # seconds
def startup(self):
# Overload the startup function
print "My Thread Starting Up..."
def cleanup(self):
# Overload the cleanup function
print "My Thread Is Shutting Down..."
# Close files, ports, etc...
time.sleep(4)
print "Cleanup Complete!"
def mainloop(self):
# Some routine to be called over and over
# ie: reading ports or sockets
print self.a + " " + self.b
# Throttling needs to be done here if the
# primary function is not blocking
time.sleep(self.delay)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qThread-0.1.0.tar.gz
(2.6 kB
view details)
File details
Details for the file qThread-0.1.0.tar.gz.
File metadata
- Download URL: qThread-0.1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e68bcae9c4a1805cf0b82c26b41acaf6f59dda5c5f9f51210b5e9a04af91e5af
|
|
| MD5 |
90312847ec278012918857253418e064
|
|
| BLAKE2b-256 |
4a5c55b69294eab63a7713c07d432b813f6091f0723d8277783439454739cd14
|