Skip to main content

stoppable and restartable thread simply using an event

Project description

```python
def func(stop_event):
while True:
if stop_event.is_set():
break
# do something

thread = StoppableThread(target=func)
thread.start()
# ...
thread.stop()
# thread.stopped() == True

thread = ReStartableThread(target=func, event_name='stop_event') # can specify the parameter's name
thread.start()
# ...
thread.stop()
# ...
thread.start()
# ...
thread.stop()
# ...
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sine.threads-0.1.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

sine.threads-0.1.3-py2.py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page