Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

V1.22 creating new thread leads to hangup #13288

Closed
Labels
@TRadigk

Description

@TRadigk

Dear micropython developers,

this morning I found about micropython V1.22 and tried this on my Raspberry Pico (non W). But unfortunately I had to find out that my programs stop when the second thread is created.

consider this boot.py to reproduce the issue:

import_threadimportmachineimportasynciofromtimeimportsleep,sleep_msasyncdefthread1task():print("thread 1 started")whileTrue:print("thread 1 talking ... ")awaitasyncio.sleep(1)defthread2task():print("thread 2 started")whileTrue:print("thread 2 talking ... ")sleep(1)if__name__=="__main__":try:loop=asyncio.get_event_loop()messagestart=const(">> starting script in ... ")print(messagestart+f"3")sleep(1)print(messagestart+f"2")sleep(1)print(messagestart+f"1")sleep(1)print(">> Loop is starting")taskobj=loop.create_task(thread1task())print(">> starting second thread...")_thread.start_new_thread(thread2task,())print(">> running loop ...")loop.run_forever()exceptKeyboardInterrupt:loop.stop()_thread.exit()# does not work, code hangsprint(f"INTERRUPTED")

The hangup is not always at the exact same spot, but the "most" debug output I could receive was:

MPY: soft reboot>> starting script in ... 3>> starting script in ... 2>> starting script in ... 1>> Loop is starting>> starting second thread...>> running loop ...thread 2 startedthread 2 talking ...

After that the serial port is blocked, device does not react to CTRL+C or any other keys.

Executing the code above with V1.21 has no issues and runs forever as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp