kthread-sleep


Namekthread-sleep JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/kthread_sleep
SummaryA killable sleep function for kthread
upload_time2023-01-08 05:19:41
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords threads kill kthread
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# A "killable" sleep function for kthread


https://pypi.org/project/kthread/

**From kthread's pypi site:**
*Assuming that the thread is not blocked by an operating system call (such as sleep, accept, or recv), the thread will forcefully quit.*


```python
pip install kthread-sleep 
import kthread
import sys
from kthread_sleep import sleep
def func():
    try:
        sleep(2000000)
    finally:
        sys.stdout.write("Greetings from Vice City!\n")
        sys.stdout.flush()

t = kthread.KThread(target = func, name = "KillableThread1")
t.start()
sleep(.1)
print(t.is_alive())
t.kill()
sleep(.1)
print(t.is_alive())

True
Greetings from Vice City!
False


```




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/kthread_sleep",
    "name": "kthread-sleep",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "threads,kill,kthread",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/70/66/afa7508bfef9229f7d1b863edd20144d2f9ea25a1952ee2e5dd80e90fa6b/kthread_sleep-0.11.tar.gz",
    "platform": null,
    "description": "\n# A \"killable\" sleep function for kthread\n\n\nhttps://pypi.org/project/kthread/\n\n**From kthread's pypi site:**\n*Assuming that the thread is not blocked by an operating system call (such as sleep, accept, or recv), the thread will forcefully quit.*\n\n\n```python\npip install kthread-sleep \nimport kthread\nimport sys\nfrom kthread_sleep import sleep\ndef func():\n    try:\n        sleep(2000000)\n    finally:\n        sys.stdout.write(\"Greetings from Vice City!\\n\")\n        sys.stdout.flush()\n\nt = kthread.KThread(target = func, name = \"KillableThread1\")\nt.start()\nsleep(.1)\nprint(t.is_alive())\nt.kill()\nsleep(.1)\nprint(t.is_alive())\n\nTrue\nGreetings from Vice City!\nFalse\n\n\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A killable sleep function for kthread",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/kthread_sleep"
    },
    "split_keywords": [
        "threads",
        "kill",
        "kthread"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83c3c9440c509e5959ce63934cabd2cb80d5671c2fb5e5f189d076ba23f4f022",
                "md5": "6286ff0845c93106120c1eb180e19cb5",
                "sha256": "ccb8d39b4053044b168012b20fd43bda69c366e5b6d030de7e4f62beb790d355"
            },
            "downloads": -1,
            "filename": "kthread_sleep-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6286ff0845c93106120c1eb180e19cb5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4597,
            "upload_time": "2023-01-08T05:19:40",
            "upload_time_iso_8601": "2023-01-08T05:19:40.242814Z",
            "url": "https://files.pythonhosted.org/packages/83/c3/c9440c509e5959ce63934cabd2cb80d5671c2fb5e5f189d076ba23f4f022/kthread_sleep-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7066afa7508bfef9229f7d1b863edd20144d2f9ea25a1952ee2e5dd80e90fa6b",
                "md5": "3555e7c43ee68c400dfaa1a256cc0773",
                "sha256": "eff9e2e8d46d37548c1a47e1e5ea09974a027a757d0611df06256cd24c5c63a8"
            },
            "downloads": -1,
            "filename": "kthread_sleep-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "3555e7c43ee68c400dfaa1a256cc0773",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3299,
            "upload_time": "2023-01-08T05:19:41",
            "upload_time_iso_8601": "2023-01-08T05:19:41.539329Z",
            "url": "https://files.pythonhosted.org/packages/70/66/afa7508bfef9229f7d1b863edd20144d2f9ea25a1952ee2e5dd80e90fa6b/kthread_sleep-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-08 05:19:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "kthread_sleep",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "kthread-sleep"
}
        
Elapsed time: 0.49713s