{ "info": { "author": "Jamie Cockburn and Andrew Binnie", "author_email": "jamie_cockburn@hotmail.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "============================\npython-multiprocessing-utils\n============================\n\nMultiprocessing utilities\n\n************\nShared locks\n************\n\n\"Shared\" version of the standard ``Lock()`` and ``RLock()`` classes found in\nthe ``multiprocessing``/``threading`` modules.\n\nShared locks can be acquired in two modes, shared and exclusive.\n\nAny number of processes/threads can acquire the lock in shared mode.\n\nOnly one process/thread can acquire the lock in exclusive mode.\n\nA process/thread attempting to exclusively acquire the lock will block\nuntil the lock has been released by all other threads/processes.\n\nA process/thread attempting to shared acquire the lock will only block\nwhile there is an exclusive lock.\n\nThis is a little like database locks, which can be acquired for shared reading,\nor exclusive writing.\n\n::\n\n lock = multiprocessing_utils.SharedLock()\n\n def exclusive_worker():\n with lock.exclusive():\n # this code will only run when no other\n # process/thread in a lock context\n\n def shared_worker():\n with lock:\n # this code will run so long as no\n # thread/process holds an exclusive lock\n\n***************************************\nmultiprocess-safe ``threading.local()``\n***************************************\n\nA process (and thread) safe version of ``threading.local()``\n\n::\n\n l = multiprocessing_utils.local()\n l.x = 1\n\n def f():\n try:\n print(l.x)\n except Attribute:\n print(\"x not set\")\n f() # prints \"1\"\n threading.Thread(target=f).start() # prints \"x not set\"\n multiprocessing.Process(target=f).start() # prints \"x not set\"\n\nDifference to standard ``threading.local()``\n--------------------------------------------\n\nA standard ``threading.local()`` instance created before forking (via\n``os.fork()`` or ``multiprocessing.Process()``) will be \"local\" as expected\nand the new process will have access to any data set before the fork.\n\nUsing a standard ``threading.local()`` in the example above would yield:\n\n::\n\n f() # prints \"1\"\n threading.Thread(target=f).start() # prints \"x not set\"\n multiprocessing.Process(target=f).start() # prints \"1\" :(\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/daggaz/python-multiprocessing-utils", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "multiprocessing-utils", "package_url": "https://pypi.org/project/multiprocessing-utils/", "platform": "", "project_url": "https://pypi.org/project/multiprocessing-utils/", "project_urls": { "Homepage": "https://github.com/daggaz/python-multiprocessing-utils" }, "release_url": "https://pypi.org/project/multiprocessing-utils/0.4/", "requires_dist": [ "six", "tox; extra == 'test'" ], "requires_python": "", "summary": "Multiprocessing utils (shared locks and thread locals)", "version": "0.4" }, "last_serial": 3265219, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "3598149703076f5676c1736c4d346002", "sha256": "d176ef30984f762fca8379f6a1f81b41324b6a6d32d59304dd998e4948a42a61" }, "downloads": -1, "filename": "multiprocessing_utils-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3598149703076f5676c1736c4d346002", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9107, "upload_time": "2017-10-19T16:48:11", "url": "https://files.pythonhosted.org/packages/15/62/bce7322d6eeac0777b2abbcb81d4addc9fbd471d73c56d5b553cba2a735d/multiprocessing_utils-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0ca806de5cc4eee5828b35435eb66fa", "sha256": "e81c444550531c4b89c9a363a22054b458560c07dd103c2df541b9d1a3a85609" }, "downloads": -1, "filename": "multiprocessing_utils-0.2.tar.gz", "has_sig": false, "md5_digest": "c0ca806de5cc4eee5828b35435eb66fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5785, "upload_time": "2017-10-19T16:48:12", "url": "https://files.pythonhosted.org/packages/07/ab/ff553902d200f3d35d8d69630d6f68ed4fc336d487d86065b4c39879a71c/multiprocessing_utils-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "93a29aa8a0e40e5ece7159b9672fa3dd", "sha256": "d3d8d5d9d55423b4b3d02b707a5ed4096a50e68d196da35a5b2bff35c9792031" }, "downloads": -1, "filename": "multiprocessing_utils-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "93a29aa8a0e40e5ece7159b9672fa3dd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9905, "upload_time": "2017-10-19T17:06:00", "url": "https://files.pythonhosted.org/packages/64/2c/37edcdaaef171b9da71ab7c73cf60dbc1b25d9f18ae9e4a63264a31b7a27/multiprocessing_utils-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "41510a44fe48cc8a8355a1339a2da1f6", "sha256": "74a462029cb4f137bac0e133a2bcf1c36b773a0f80808b70b5e6760a10572b77" }, "downloads": -1, "filename": "multiprocessing_utils-0.3.tar.gz", "has_sig": false, "md5_digest": "41510a44fe48cc8a8355a1339a2da1f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6298, "upload_time": "2017-10-19T17:06:01", "url": "https://files.pythonhosted.org/packages/df/8f/b90184fe1894d8ef8c6963970f83fab2551b950b797394acd1c07fabea70/multiprocessing_utils-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "7c057eb3f3378966d3a7e59868426718", "sha256": "c232e0bbc6ba753ca7a0df5d49b0cc4e26454635d4f373f5133c551aec8c27ee" }, "downloads": -1, "filename": "multiprocessing_utils-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7c057eb3f3378966d3a7e59868426718", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10504, "upload_time": "2017-10-20T10:50:00", "url": "https://files.pythonhosted.org/packages/70/5c/2e3065be295ca10f39d22579fc59ba8dd258123b0d66209bb4ff7c3d4557/multiprocessing_utils-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "688bb388d0dbb506c37d11bccca2246b", "sha256": "43281d5e017d9b3f3e6114762c21f10c2a2b0392837c5096380e6c413ae79b6c" }, "downloads": -1, "filename": "multiprocessing_utils-0.4.tar.gz", "has_sig": false, "md5_digest": "688bb388d0dbb506c37d11bccca2246b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6720, "upload_time": "2017-10-20T10:50:01", "url": "https://files.pythonhosted.org/packages/7f/23/ee76f1f2d501411afc152208d30d1575a8e76929eca276b94f4e44600085/multiprocessing_utils-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7c057eb3f3378966d3a7e59868426718", "sha256": "c232e0bbc6ba753ca7a0df5d49b0cc4e26454635d4f373f5133c551aec8c27ee" }, "downloads": -1, "filename": "multiprocessing_utils-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7c057eb3f3378966d3a7e59868426718", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10504, "upload_time": "2017-10-20T10:50:00", "url": "https://files.pythonhosted.org/packages/70/5c/2e3065be295ca10f39d22579fc59ba8dd258123b0d66209bb4ff7c3d4557/multiprocessing_utils-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "688bb388d0dbb506c37d11bccca2246b", "sha256": "43281d5e017d9b3f3e6114762c21f10c2a2b0392837c5096380e6c413ae79b6c" }, "downloads": -1, "filename": "multiprocessing_utils-0.4.tar.gz", "has_sig": false, "md5_digest": "688bb388d0dbb506c37d11bccca2246b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6720, "upload_time": "2017-10-20T10:50:01", "url": "https://files.pythonhosted.org/packages/7f/23/ee76f1f2d501411afc152208d30d1575a8e76929eca276b94f4e44600085/multiprocessing_utils-0.4.tar.gz" } ] }