{"action":"created","issue":{"url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55","repository_url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo","labels_url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55/comments","events_url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55/events","html_url":"https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55","id":282152547,"number":55,"title":"Lock object support in _thread implementation?","user":{"login":"rasmorthil","id":11828689,"avatar_url":"https://avatars2.githubusercontent.com/u/11828689?v=4","gravatar_id":"","url":"https://api.github.com/users/rasmorthil","html_url":"https://github.com/rasmorthil","followers_url":"https://api.github.com/users/rasmorthil/followers","following_url":"https://api.github.com/users/rasmorthil/following{/other_user}","gists_url":"https://api.github.com/users/rasmorthil/gists{/gist_id}","starred_url":"https://api.github.com/users/rasmorthil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasmorthil/subscriptions","organizations_url":"https://api.github.com/users/rasmorthil/orgs","repos_url":"https://api.github.com/users/rasmorthil/repos","events_url":"https://api.github.com/users/rasmorthil/events{/privacy}","received_events_url":"https://api.github.com/users/rasmorthil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-12-14T16:07:32Z","updated_at":"2017-12-23T17:05:08Z","closed_at":null,"author_association":"NONE","body":"Do you have plans to implement Lock object support in your _thread class implementation?  For example, currently \"allocate_lock\" etc. is commented out for the _thread object in \"modthread.c\":\r\n\r\n> components/micropython/py/modthread.c:    //{ MP_ROM_QSTR(MP_QSTR_allocate_lock), MP_ROM_PTR(&mod_thread_allocate_lock_obj) },\r\n\r\nWithout this support it seems that one has to resort to polling with your thread notification functions, which is unfortunate...  Or is there another way one can perform true blocking synchronization between threads with your implementation?\r\n"},"comment":{"url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/comments/353737136","html_url":"https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55#issuecomment-353737136","issue_url":"https://api.github.com/repos/loboris/MicroPython_ESP32_psRAM_LoBo/issues/55","id":353737136,"user":{"login":"loboris","id":6280349,"avatar_url":"https://avatars3.githubusercontent.com/u/6280349?v=4","gravatar_id":"","url":"https://api.github.com/users/loboris","html_url":"https://github.com/loboris","followers_url":"https://api.github.com/users/loboris/followers","following_url":"https://api.github.com/users/loboris/following{/other_user}","gists_url":"https://api.github.com/users/loboris/gists{/gist_id}","starred_url":"https://api.github.com/users/loboris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loboris/subscriptions","organizations_url":"https://api.github.com/users/loboris/orgs","repos_url":"https://api.github.com/users/loboris/repos","events_url":"https://api.github.com/users/loboris/events{/privacy}","received_events_url":"https://api.github.com/users/loboris/received_events","type":"User","site_admin":false},"created_at":"2017-12-23T17:05:08Z","updated_at":"2017-12-23T17:05:08Z","author_association":"OWNER","body":"I'll try to analyze this to be able to give you more precise answer.\r\n\r\nFor now, just couple remarques:\r\n~ Sending/getting notifications is very fast as it operates on RTOS level.\r\n~ When `time.sleep_ms(ms)` is executed the thread is actually suspended (as RTOS task) and no CPU resources are used.\r\n\r\nThere is also the function **_thread.waitnotification(timeout)** which suspends the thread (on FreeRTOS level) until a notification is received or the timeout expires. It is similar to _time.sleep_ms()_, but continues the execution if/when the notification is received. It uses no Python or C CPU time (handled by FreeRTOS).\r\nI don't remember why I haven't included it in this repository. I'll check it.\r\n\r\nI'll try to do more testing/measurement, but I don't beleeve the (python handled) lock accquire/release approach would have lower latency.\r\n\r\nAt the moment, thread is not allowed to susppend itself. I'll investigate if it is safe to enable it.\r\nThis could probably be the fastest way to \"lock\" / \"unlock\" the thread.\r\n\r\n\r\nThanks for starting this issue, for me, the good threads support is very important, I'll try to make it better."}}
{"actor":{"display_login":"loboris"}}