Example
from sine.threads import *
def func(stop_event):
while 1:
if stop_event.is_set():
break
# do your work
thread = StoppableThread(target=func)
thread.start()
# ...
thread.stop(-1) # stop and join forever
# thread.stopped() == True
thread = ReStartableThread(target=func, event_name='stop_event') # can specify the parameter's name
thread.start()
# ...
thread.stop(1) # stop and join for 1 second
# ...
thread.start()
# ...
thread.stop()
thread.join()
# ...
Changelog
v0.1.7, 2019-2-9
- change to run with python3
v0.1.6, 2018-10-7
- stop() become stop(timeout=0) to join the thread for convenience and return whether it is alive.
- when the event_name is not specified, it is not strict to receive
the stop event any more, and it will be added to 'args'
so it can be receive by
*args'or other argument - add: thread lock
v0.1.5, 2018-9-11
- fix logic about join(), when directly join() without start() but stop()
v0.1.4, 2018-6-7
- ReStartableThread support join the old thread instance
- fix: ReStartableThread.start always creates new instance
- improve comment and change to English
- change directory structure and update setup.py
- add tests.py
Metadata
Release files for sine.threads 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sine.threads-0.1.7.tar.gz | 6.6 kB | Without provenance | Details for sine.threads-0.1.7.tar.gz |
Release files / sine.threads-0.1.7.tar.gz
| Download URL | sine.threads-0.1.7.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46675a1bc53b8537684b945762e35ad5ffed3babea2245d1c48a03423df041c
|
|
BLAKE2b-256 checksum How to use checksums |
44f02be4eb4afb05f51633a4b995fd52f7c3da1bc5a51395f2eec4214b610d6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.2
|
Security for sine.threads 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.