Skip to main content
# threadedreturn

`threadedreturn` is a Python package that provides a simple extension to the built-in `Thread` class in the `threading` module. The `ThreadWithReturnValue` class in this package allows you to create threads with return values.

## Installation

You can install `threadedreturn` using `pip`:

```bash
pip install threadedreturn
```

## Usage

### ThreadWithReturnValue

`ThreadWithReturnValue` is a subclass of `Thread` that enables you to retrieve the return value of a function or method running in a separate thread.

#### Example

```python
from threadedreturn import ThreadWithReturnValue

# Define a function to be executed in a separate thread
def my_function(arg1, arg2):
    # Some time-consuming task
    result = arg1 + arg2
    return result

# Create a ThreadWithReturnValue instance
thread = ThreadWithReturnValue(target=my_function, args=(3, 5))

# Start the thread
thread.start()

# Wait for the thread to finish and retrieve the return value
result = thread.join()

print("Result:", result)
```

## Contributing

If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/DWAA1660/threadedreturn).

Release files for threadedreturn 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for threadedreturn 1.0.1
File Size Uploaded
threadedreturn-1.0.1.tar.gz 2.0 kB Details

Release files / threadedreturn-1.0.1.tar.gz

Download URL threadedreturn-1.0.1.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
18abf8d72df2043f49a678c4a0e35c7e5b506bd64723f2d89fa500ccd53a475d
BLAKE2b-256 checksum
How to use checksums
3eeacd7dd04959b22790c38baf559cba1640c1596938d9acf7261c92fb3f0f94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page