Hello,
I have tried the following simple threading program on the esp32 board via webrepl.
>>> import _thread
>>> def bar():
... _thread.start_new_thread(foo, (10, 200))
... _thread.start_new_thread(foo, (200, 400))
...
>>> bar()
I got disconnected from webrepl everytime I ran bar().
I understand _thread is still experimental, but this seems quite basic though.
Running 1 thread works fine btw.
a-ha
Getting disconnected from webrepl when creating 2 threads
Re: Getting disconnected from webrepl when creating 2 threads
I don't see any reason why that doesn't work. What does "foo" do?
(Also, I would recommend looking at asyncio instead of thread if that's an option for you)
(Also, I would recommend looking at asyncio instead of thread if that's an option for you)
Re: Getting disconnected from webrepl when creating 2 threads
foo() is a simple function which print the integer between the 2 passed arguments.
Something like this:
def foo(a, b):
for i in range(a, b):
print i
Certainly broken with 2 threads, but works with only 1 thread.
Will look into asyncio.
Something like this:
def foo(a, b):
for i in range(a, b):
print i
Certainly broken with 2 threads, but works with only 1 thread.
Will look into asyncio.