pycom / pycom-esp-idf

A fork of the Espressif IDF
Apache License 2.0
54 stars 62 forks source link

disable mutex owner check #33

Closed peter-pycom closed 3 years ago

peter-pycom commented 3 years ago

this allows use cases like:

import _thread
import time

main_lock = _thread.allocate_lock()

def thread_function():
    print('thread_function')
    for t in range(5):
        print(t)
    print('thread_function check lock')
    if main_lock.locked():
        print('thread_function unlock')
        time.sleep(1)
        # this core dumps when CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
        main_lock.release()

print('main')
time.sleep(1)
main_lock.acquire()
print('locked')
print('start thread')
_thread.start_new_thread(thread_function, ())
print('try to acquire')
time.sleep(5)
main_lock.acquire()
print('juhuu')

I'm fine to do it in this project. I'm still a bit doubtful whether we should do this in the general firmware ... but it's an interesting use case that isn't really covered otherwise ... maybe uasyncio ...

CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.