Name | threadedreturn JSON |
Version | 1.0.1 JSON |
download | |
home_page | |
Summary | Use threads with return values |
upload_time | 2023-11-12 23:46:14 |
maintainer | |
docs_url | None |
author | |
requires_python | |
license | |
keywords | threads threading concurrency |
VCS | |
bugtrack_url | |
requirements | No requirements were recorded. |
Travis-CI | No Travis. |
coveralls test coverage | No coveralls. |
# 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).
{ "_id": null, "home_page": "", "name": "threadedreturn", "maintainer": "", "docs_url": null, "requires_python": "", "maintainer_email": "", "keywords": "threads,threading,concurrency", "author": "", "author_email": "", "download_url": "https://files.pythonhosted.org/packages/3e/ea/cd7dd04959b22790c38baf559cba1640c1596938d9acf7261c92fb3f0f94/threadedreturn-1.0.1.tar.gz", "platform": null, "description": "\n # threadedreturn\n\n `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.\n\n ## Installation\n\n You can install `threadedreturn` using `pip`:\n\n ```bash\n pip install threadedreturn\n ```\n\n ## Usage\n\n ### ThreadWithReturnValue\n\n `ThreadWithReturnValue` is a subclass of `Thread` that enables you to retrieve the return value of a function or method running in a separate thread.\n\n #### Example\n\n ```python\n from threadedreturn import ThreadWithReturnValue\n\n # Define a function to be executed in a separate thread\n def my_function(arg1, arg2):\n # Some time-consuming task\n result = arg1 + arg2\n return result\n\n # Create a ThreadWithReturnValue instance\n thread = ThreadWithReturnValue(target=my_function, args=(3, 5))\n\n # Start the thread\n thread.start()\n\n # Wait for the thread to finish and retrieve the return value\n result = thread.join()\n\n print(\"Result:\", result)\n ```\n\n ## Contributing\n\n 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).\n\n \n\n", "bugtrack_url": null, "license": "", "summary": "Use threads with return values", "version": "1.0.1", "project_urls": null, "split_keywords": [ "threads", "threading", "concurrency" ], "urls": [ { "comment_text": "", "digests": { "blake2b_256": "3eeacd7dd04959b22790c38baf559cba1640c1596938d9acf7261c92fb3f0f94", "md5": "b453d00d8aae8e8802ce2744f7ed9051", "sha256": "18abf8d72df2043f49a678c4a0e35c7e5b506bd64723f2d89fa500ccd53a475d" }, "downloads": -1, "filename": "threadedreturn-1.0.1.tar.gz", "has_sig": false, "md5_digest": "b453d00d8aae8e8802ce2744f7ed9051", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2022, "upload_time": "2023-11-12T23:46:14", "upload_time_iso_8601": "2023-11-12T23:46:14.989283Z", "url": "https://files.pythonhosted.org/packages/3e/ea/cd7dd04959b22790c38baf559cba1640c1596938d9acf7261c92fb3f0f94/threadedreturn-1.0.1.tar.gz", "yanked": false, "yanked_reason": null } ], "upload_time": "2023-11-12 23:46:14", "github": false, "gitlab": false, "bitbucket": false, "codeberg": false, "lcname": "threadedreturn" }