Metadata-Version: 2.1
Name: call_function_with_timeout
Version: 1.1.0
Summary: Python Call function with timeouts
Home-page: https://github.com/yang445786754/call_function_with_timeout
Author: Tony_9410
Author-email: tony_9410@foxmail.com
Project-URL: Homepage, https://github.com/yang445786754/call_function_with_timeout
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# call_function_with_timeout
A library to make your funtions support timeouts

Example

```python
import time
from call_function_with_timeout import SetTimeout

# make your function
def do_something(a=0, b=0):
    time.sleep(10)
    print(a + b)

# define function with timeout
func_with_timeout = SetTimeout(do_something, timeout=5)
# call the function
is_done, is_timeout, erro_message, results = func_with_timeout(a=12, b=8)

```
You will find that after the method is called to the time you specified, it will return and kill the currently executing thread.

You can also use it as a decorator

```python
import time
from call_function_with_timeout import SetTimeoutDecorator

# make your function with timeout
@SetTimeoutDecorator(timeout=5)
def do_something(a=0, b=0):
    time.sleep(10)
    print(a + b)

# call the function
is_done, is_timeout, erro_message, results = do_something(a=12, b=8)

```
